没用过logstash,看了好长时间,也把日志全都整理成了纯JSON格式,但按照网上看来看去的所谓的教程,完全写不出来
5条回答
- 玄尺 2018-09-05 01:28关注
input { file { path => ["/your/log/path/1.log"] start_position => "beginning" type => "type1" codec => multiline { pattern => "^\d" negate => true what => "previous" } } file { path => ["/your/log/path/2.log"] start_position => "beginning" type => "type2" codec => multiline { pattern => "^{" negate => true what => "previous" } } } filter { if [type] == "type2" { mutate { remove_field => ["@version", "host", "path", "@timestamp", "type", "tags"] } } } output { if [type] == "type1" { elasticsearch { index => 'log-index1-%{+YYYY-MM-dd}' hosts => ["192.168.41.31:9200"] user => "logger" password => "password" } } else { kafka { bootstrap_servers => "192.168.41.33:9092,192.168.41.20:9092,192.168.41.32:9092" topic_id => "healthTrace" client_id => "logstash" batch_size => 200 codec => plain { format => "%{message}" } } } }
解决 无用评论 打赏 举报
悬赏问题
- ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
- ¥20 腾讯企业邮箱邮件可以恢复么
- ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
- ¥15 错误 LNK2001 无法解析的外部符号
- ¥50 安装pyaudiokits失败
- ¥15 计组这些题应该咋做呀
- ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
- ¥15 让node服务器有自动加载文件的功能
- ¥15 jmeter脚本回放有的是对的有的是错的
- ¥15 r语言蛋白组学相关问题