下面是我的mutate过滤器配置,其中caller和callee数据的格式如下。它不起作用,因为类型转换时调用者和被调用者数据都设置为0。当我使用单独的mutate过滤器进行类型转换时,转换工作正常。为什么我的第一个配置不起作用?
"caller":"caller:123"
"callee":"callee:123"
mutate {
gsub => [
#regex to remove : and every thing before it
"caller", "^[^:]*:", "",
"callee","^[^:]*:", ""
]
convert => {
#type conversion from string to integer
"caller" => "integer"
"callee" => "integer"
}
}
类型转换工作正常,使用了两个单独的mutate过滤器
mutate {
gsub => [
#regex to remove : and every thing before it
"caller", "^[^:]*:", "",
"callee","^[^:]*:", ""
]
}
mutate {
convert => { "caller" => "integer"
"callee"=> "integer"
}
}
答案 0 :(得分:1)
显然,从源代码开始,在gsub操作之前调用convert操作。
def filter(event)
...
convert(event) if @convert
gsub(event) if @gsub