logstash7.2安装 入门例子--hello world!
官网下载历史把本(太慢,有时候访问不了):
https://www.elastic.co/cn/downloads/past-releases
云盘安装包提供:
javascript:void(0)
下载7.2版本,解压即可运行
tar -zxvf logstash-7.2.0.tar.gz
启动:
#test.conf就是我们需要编写的配置文件
bin/logstash -f test.conf
#后台运行
nohup bin/logstash -f test.conf >/dev/null &
#自动加载配置文件的方式
bin/logstash -f test.conf --config.reload.automatic
#测试配置文件是否OK
bin/logstash -f test.conf --config.test_and_exit
配置文件的结构
input {
... #输入
}
filter {
... #数据处理转换
}
output {
... #输出
}
最简单的例子:
1、vim test.conf,内容如下
input {
stdin { }
}
filter {
}
output {
stdout { }
}
敲入 Hello World !,回车
{
"@timestamp" => 2020-03-25T11:43:41.365Z,
"host" => "es3",
"message" => "hello world !",
"@version" => "1"
}