I try to use a sprintf format in a IF statement in output bloc but failled.
filter {
mutate {
add_field => { "systype" => "cpu" }
}
}
output {
if [event][dataset] == "system.%{systype}" {
elasticsearch {
...
=> never go into the elastic output
filter {
mutate {
add_field => { "systype" => "cpu" }
}
mutate {
add_field => { "systype2" => "system.%{systype}" }
}
}
output {
if [event][dataset] == [systype2] {
elasticsearch {
...
=> It's OK
why ?