疲劳是最舒适的枕头,努力工作吧。

logstash type匹配问题

Logstash | 作者 Tiny_liu | 发布于2017年09月30日 | 阅读数:7760

input中定义了type,用于不同input连接不同filter处理并输出,但是输入的日志中有type项,匹配时出错了,output时再使用type创建index时,index名字变为了输入日志中的type
input{
      kafka{
             bootstrap_servers => "192.168.40.12:9092,192.168.40.15:9092,192.168.40.10:9092"
             topics => ["message"]
             type => "sys-log"
            }
}
已邀请:

Tiny_liu

赞同来自: tacsklet

已解决:
         由于使用filebeat搜集日志
processors:
 - drop_fields:
     fields: ["input_type","offset"]
虽然drop_fields可以移除字段,但是@timestamp和type字段无法删除,这样type字段与logstash input中type字段重复。
 
解决方法:
            mutate{
            add_field=> {"type1"=>"%{type}"}   //input中type改为type1
            remove_field=>["type"]
            }
           。。。。。。。
           remove_field=>["type"]
          。。。。。。。
            mutate{
            add_field=> {"type"=>"%{type1}"}   //将input带来已改为type1的字段变为type
            remove_field=>["type1"]
            }
先将input中type在filter处理时先改为type1,处理message时,匹配字段完成后,将type字段删除,最后将type1字段改回type

liushuwang

赞同来自:

logstash执行顺序input  filter  output,上面说的这种处理,请问是如何实现的???
 

要回复问题请先登录注册