Creating an array of objects

Lets say in a given event i have 4 fields
psn1_name (holding the value "A",
psn1_age (holding the value 10,
psn2_name (holding the value "B",
psn2_age (holding the value 20.
I want to create a field person such that person is of the following structure

person = [
{
"name":"A"
,"age":10
},
{
"name":"B"
,"age":20
}
]

Can someone please suggest how to achieve this in the filter section of my logstash configuration.

Hmm. I'm not entirely sure that you can do this with a mutate filter. You may have to use a ruby filter and write a line or two of Ruby code.

Thanks. Looks like that is the only option

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.