Events generated by the metrics
filter ignore conditionals and execute all filters after the metrics
filter.
Logstash version: 6.4.2
logstash.conf:
input {
tcp {
port => 11224
}
}
filter {
kv { }
if 'true' {
if 'true' {
metrics {
meter => {'http_%{response}' => '%{response}'}
add_tag => [ 'metric1' ]
}
}
}
else if 'false' == 'true' {
mutate { add_tag => [ 'metric2' ] }
}
else {
mutate { add_tag => [ 'metric3' ] }
}
}
output {
stdout {
codec => rubydebug { metadata => true }
}
}
Expected output should contain the metric1
tag only but Logstash includes tags added in different conditional blocks:
{
"@timestamp" => 2018-10-23T17:07:06.028Z,
"\"http_200\", \"200\"" => {
"rate_15m" => 0.16014748058336145,
"rate_1m" => 0.00713479866945049,
"count" => 1,
"rate_5m" => 0.10268342380651842
},
"@version" => "1",
"message" => "539d27e3f0df",
"tags" => [
[0] "metric1",
[1] "metric2",
[2] "metric3"
]
}