logstash搭建及其配置
1、下载
https://artifacts.elastic.co/downloads/logstash/logstash-5.4.0.rpm
2、安装
yum install -y logstash-5.4.0.rpm
3、测试
1)输出到屏幕
/usr/share/logstash/bin/logstash -e ‘input { stdin {} } output { stdout { codec => rubydebug}}‘
当屏幕输出:Successfully started Logstash API字样时说明测试成功
输出解释 :
"@timestamp" 当前时间
"@version" 版本
"host" 事件发生的主机
"message" 内容
https://www.elastic.co/guide/index.html查看用法
2)测试输出到文件
/usr/share/logstash/bin/logstash -e ‘input { stdin {} } output { file { path =>"/tmp/log" } }‘
3)输出到文件带压缩
/usr/share/logstash/bin/logstash -e ‘input { stdin {} } output { file { path =>"/tmp/log.tar.gz" gzip => true } }‘
4、输出到elasticsearch
/usr/share/logstash/bin/logstash -e ‘input { stdin {} } output { elasticsearch { hosts => ["10.1.2.184:9200"] index => "logstash-test-%{+YYYY.MM.dd}" }}‘
https://artifacts.elastic.co/downloads/logstash/logstash-5.4.0.rpm
2、安装
yum install -y logstash-5.4.0.rpm
3、测试
1)输出到屏幕
/usr/share/logstash/bin/logstash -e ‘input { stdin {} } output { stdout { codec => rubydebug}}‘
当屏幕输出:Successfully started Logstash API字样时说明测试成功
输出解释 :
"@timestamp" 当前时间
"@version" 版本
"host" 事件发生的主机
"message" 内容
https://www.elastic.co/guide/index.html查看用法
2)测试输出到文件
/usr/share/logstash/bin/logstash -e ‘input { stdin {} } output { file { path =>"/tmp/log" } }‘
3)输出到文件带压缩
/usr/share/logstash/bin/logstash -e ‘input { stdin {} } output { file { path =>"/tmp/log.tar.gz" gzip => true } }‘
4、输出到elasticsearch
/usr/share/logstash/bin/logstash -e ‘input { stdin {} } output { elasticsearch { hosts => ["10.1.2.184:9200"] index => "logstash-test-%{+YYYY.MM.dd}" }}‘
相关推荐
goodstudy 2020-08-19
weikaixxxxxx 2020-08-01
liulin0 2020-07-26
AFei00 2020-07-26
娜娜 2020-07-20
偏头痛杨 2020-07-18
winxcoder 2020-07-18
superviser000 2020-06-28
liulin0 2020-06-25
liulin0 2020-06-16
wangfengqingyang 2020-06-11
cullinans 2020-06-09
winxcoder 2020-06-08
citic 2020-06-06
goodstudy 2020-06-05
superviser000 2020-05-30
yuzhongdelei0 2020-05-15
wzhwangzhuohui 2020-05-12
李玉志 2020-05-11