Greetings
My events sometimes have a field "foo" equal to a single value, sometimes an array of multiple distinct values, and sometimes an array of exactly two equal values.
I would like to convert the last case to the first case.
For example, I would like to convert this
"foo": [
"bar",
"bar"
],
to
"foo": "bar"
Is there an easy method to do this? I was thinking i could do something along those lines:
if foo[0] == foo[1]
mutate {
foo_tmp = foo[0]
remove foo
foo = foo_tmp
remove foo_tmp
}
but I am unsure about the exact syntax when it comes to array element access.