logstash安装

准备

Github

官网下载

运行

命令行运行

1
./bin/logstash -e 'input { stdin { } } output { stdout {} }'

等待数秒logstash输出Successfully started Logstash API endpoint {:port=>9600}的字样时表示logstash启动成功。

控制台输入hello world后回车,logstash控制台输出如下内容:

1
2
3
4
5
6
{
"@version" => "1",
"host" => "VM_0_10_centos",
"@timestamp" => 2019-01-15T13:07:10.186Z,
"message" => "hello world"
}

配置文件运行

1
./bin/logstash -f file