ELK之logstash的輸入輸出-3
阿新 • • 發佈:2019-04-03
elastic cto elastics bin code output sta 技術 技術分享 logstash的標準輸入輸出
[[email protected] logstash]# ./bin/logstash -e ‘input { stdin{} } output { stdout{ codec => rubydebug }}‘ hellow word { "message" => "hellow", "host" => "elk-node01", "@version" => "1", "@timestamp" => 2019-04-03T03:20:27.319Z } { "message" => "word", "host" => "elk-node01", "@version" => "1", "@timestamp" => 2019-04-03T03:20:27.339Z }
測試輸出到文件
[[email protected] logstash]# ./bin/logstash -e ‘input { stdin{} } output { file { path => "/tmp/hanye-%{+YYYY.MM.dd}"}}‘ hellow word [2019-04-03T11:24:59,845][INFO ][logstash.outputs.file ] Opening file {:path=>"/tmp/hanye-2019.04.03"} [[email protected] logstash]# cat /tmp/hanye-2019.04.03 {"@version":"1","@timestamp":"2019-04-03T03:24:59.555Z","message":"word","host":"elk-node01"} {"@version":"1","@timestamp":"2019-04-03T03:24:59.523Z","message":"hellow","host":"elk-node01"}
測試輸出到elasticesearch
[[email protected] logstash]# ./bin/logstash -e ‘input { stdin{} } output { elasticsearch {hosts => ["192.168.1.252:9200"] index => "hanye-%{+YYYY.MM.dd}" }}‘
hellow
word
ELK之logstash的輸入輸出-3