Home | 簡體中文 | 繁體中文 | 雜文 | 知乎專欄 | Github | OSChina 博客 | 雲社區 | 雲棲社區 | Facebook | Linkedin | 視頻教程 | 打賞(Donations) | About
知乎專欄多維度架構 微信號 netkiller-ebook | QQ群:128659835 請註明“讀者”

3.2. logstash 命令簡單應用

3.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 {}}'			
			
			

3.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	
			
			

3.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
			
			

3.2.4. -l:日誌輸出的地址

預設就是stdout直接在控制台中輸出

3.2.5. log.level 啟動Debug模式

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