Hi
When using if ... in [array] for Logstash with version 8.15.0:
input { generator { count => 1 } }
filter {
if "a" in ["a","b"] {
mutate {
add_field => { "test_field" => "1" }
}
}
}
output {
stdout {}
}
my questions are:
- When I use this way:
if "a" in ["a","b"]
"test_field" does not appear in my test, hope someone could explain why.
- Puzzle with:
if .. in []
doesn't match for single-element arrays · Issue #9932 · elastic/logstash (github.com)
I test a different implement but same idea with my Logstash mention above, it appear that this is not true, array with one value still return as expected, like:
if "element_in_array" in [one_element_array] => true
I hope some verify or information so that myself or someone could suggest this ticket to be closed, because It make me so confuse about the use of if ... in [array].