Hi,
I'm having an issue with conditionals and numeric fields. The config below only works if I first convert my fields to a string.
I found a blog that mentions if ([foo]) { ... }
should work for numeric fields but
if ([netflow][l4_src_port]) == "8888" {
drop { }
}
does not (logstash trows an error). I couldn't find anything in the Docs either.
What is the correct way to handle numeric fields and conditionals?
filter {
if [type] == "netflow" {
if ![netflow][ipv4_src_addr] {
drop { }
}
mutate {
convert => { "[netflow][l4_src_port]" => "string" }
convert => { "[netflow][l4_dst_port]" => "string" }
}
if [netflow][l4_src_port] == "8888" {
drop { }
}
if [netflow][l4_dst_port] == "8888" {
drop { }
}
if [netflow][l4_src_port] == "9993" {
drop { }
}
if [netflow][l4_dst_port] == "9993" {
drop { }
}