我的 webapplog 中有一个字段 traceinfo.duration。 ES 将其映射为字符串,但我想将其字段类型更改为整数。我的 logstash.conf 包含以下过滤器部分:
filter {
if "webapp-log" in [tags] {
json { source => "message" }
mutate {
convert => {"[traceinfo][duration]" => "integer"}
}
mutate {
remove_field => ["[beat][hostname]","[beat][name]"]
}
}
}
我正在用这个配置创建一个新索引来测试它。但是我在 kibana 中的字段类型仍然是 traceinfo.duration 字段的字符串。我的 logstash 版本是 5.3.0。请帮助
试试这个方法
filter {
mutate {
convert => { "field" => "integer" }
}
}
field 是要转换为整数类型的键的名称。