Home | 简体中文 | 繁体中文 | 杂文 | 打赏(Donations) | 云栖社区 | OSChina 博客 | Facebook | Linkedin | 知乎专栏 | Github | Search | About

21.2. logstash 命令简单应用

21.2.1. -e 命令行运行

logstash -e "input {stdin{}} output {stdout{}}"

			
/usr/share/logstash/bin/logstash  -e 'input{file {path => "/etc/centos-release" start_position => "beginning"}} output { stdout {}}'			
			
			

21.2.2. -f 指定配置文件

			
/usr/share/logstash/bin/logstash -f stdin.conf		

/usr/share/logstash/bin/logstash -f jdbc.conf --path.settings /etc/logstash --path.data /tmp	
			
			

21.2.3. -t:测试配置文件是否正确,然后退出。

			
root@netkiller ~/logstash % /usr/share/logstash/bin/logstash -t -f test.conf
WARNING: Default JAVA_OPTS will be overridden by the JAVA_OPTS defined in the environment. Environment JAVA_OPTS are -server -Xms2048m -Xmx4096m
WARNING: Could not find logstash.yml which is typically located in $LS_HOME/config or /etc/logstash. You can specify the path using --path.settings. Continuing using the defaults
Could not find log4j2 configuration at path /usr/share/logstash/config/log4j2.properties. Using default config which logs errors to the console
Configuration OK
			
			

21.2.4. -l:日志输出的地址

默认就是stdout直接在控制台中输出

21.2.5. log.level 启动Debug模式

			
% /usr/share/logstash/bin/logstash -f nginx.conf --path.settings /etc/logstash --log.level debug