我在使用mutate过滤器时出现问题,我需要将字段副本设置为小写。 但是当我尝试加载弹性时,字段副本不会小写。
我的Logstash版本是5.2
我使用以下配置:
filter {
mutate {
rename => {"desc_ufe" => "state" }
rename => {"desc_local" => "city" }
rename => {"desc_bairro" => "neighborhood" }
rename => {"desc_lograd" => "streetName" }
rename => {"desc_cep" => "postalCode" }
rename => {"desc_lograd_complemento" => "supplement" }
rename => {"cod_mun" => "IBGEcode" }
convert => {"IBGEcode" => "string"}
add_field => {"statecp" => "%{state}"}
add_field => {"citycp" => "%{city}"}
add_field => {"neighborhoodcp" => "%{neighborhood}"}
add_field => {"streetNamecp" => "%{streetName}"}
add_field => {"supplementcp" => "%{supplement}"}
lowercase => ["statecp","citycp","neighborhoodcp","streetNamecp","supplementcp"]
}
}
感谢您的帮助。
答案 0 :(得分:1)
你正在成为mutate过滤器做事的命令的牺牲品。它不是基于配置文件中的顺序 - 它基于mutate.rb代码执行的顺序。
其他适用于匹配事件的内容(即add_field
)
只需将您的lowercase
移至第二个mutate
过滤器即可正常使用。