Hi,
I'm quite new in ELK and I've encountered a problem almost imposible to break for me.
I have an XML like this:
< root >
< field_A>
< subfield_A >8100291240
< subfield_B >3
< subfield_C >6000436355
< subfield_D >
< subfield_DD >1000
</ subfield_D >
</ field_A>
...
< field_A>
< subfield_A >8100291240
< subfield_B >3
< subfield_C >6000436355
< subfield_D >
< subfield_DD >1000
</ subfield_D >
</ field_A>
The field_A with that format repets for the whole XML thousands of times. My first approach was to use the XML filter to obtain the elements, but I only need two subfields from field_A.
At first, I used this:
add_field => {
field_A => "%{[root][field_A][0][subfield_A ]}"
}
I changed the 0 for a 1, and true enough, I was able to access the second element of the array. It worked like charm but... The problem is that I need to use the same field ALL the time and I don't know beforehand how many "field_A" can I find in the XML. I tried to look for some kind of loop in logstash... No luck.
So, I decided to use the ruby filter, it took me a while but I was able to navigate inside the nested fields but again, same problem, I could only access to an specific element. For that I used this:
code => "event['root'] = event['root']['field_A'][1]['subfield_A']".
So, my question is, how can I use a single key for logstash, having multiple values knowing that this "funcionality" is written inside a way larger configuration file?
In other words, ideally, I'll need something like this:
field_A => {
[subfield_A , subfield_B ],
[subfield_A , subfield_B ],
.
.
.
[subfield_A , subfield_B ]
}
I'm already losing my mind, any help would be appreciated.