logstash的标准输入输出

[root@elk-node01 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
}

测试输出到文件

 [root@elk-node01 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"}
 [root@elk-node01 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

[root@elk-node01 logstash]# ./bin/logstash -e 'input {  stdin{} } output { elasticsearch {hosts => ["192.168.1.252:9200"] index => "hanye-%{+YYYY.MM.dd}" }}' 
  hellow
  word    

ELK之logstash的输入输出-3
ELK之logstash的输入输出-3