ELK之logstash的输入输出-4
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ELK之logstash的输入输出-4相关的知识,希望对你有一定的参考价值。
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的输入输出-4的主要内容,如果未能解决你的问题,请参考以下文章