Hello!
Wonder if someone could help me how to divide my XML into several events for their further parsing
I have the following XML file (yes, everything in one row):
<nodes><PROCESS_GROUP><PROCESS A="1" B="2" C="3" D="4" E="5">process_1</PROCESS><PROCESS A="6" B="7" C="8" D="9" E="10">process_2</PROCESS></PROCESS_GROUP><SESSION_GROUP><SESSION AA="11" BB="22" CC="33">session_11</SESSION><SESSION AA="44" BB="55" CC="66">session_22</SESSION></SESSION_GROUP></nodes>
and I would like using logstash to receive 4 events in the output like this:
[event_1]
"process" : "<PROCESS A="1" B="2" C="3" D="4" E="5">process_1</PROCESS>"
[event_2]
"process" : "<PROCESS A="6" B="7" C="8" D="9" E="10">process_2</PROCESS>"
[event_3]
"session" : "<SESSION AA="11" BB="22" CC="33">session_11</SESSION>"
[event_4]
"session" : "<SESSION AA="44" BB="55" CC="66">session_22</SESSION>"
I tried using the following conf file:
input {
file {
path => "/files/input"
start_position => "beginning"
}
}
filter {
xml {
source => "message"
store_xml => false
xpath => [
"/nodes/PROCESS_GROUP/PROCESS", "process",
"/nodes/SESSION_GROUP/SESSION", "session"
]
}
split {
field => "process"
}
split {
field => "session"
}
}
output {
stdout {}
}
However, I received these events:
[event_1]
"process" : "<PROCESS A="1" B="2" C="3" D="4" E="5">process_1</PROCESS>"
"session" : "<SESSION AA="11" BB="22" CC="33">session_11</SESSION>"
[event_2]
"process" : "<PROCESS A="1" B="2" C="3" D="4" E="5">process_1</PROCESS>"
"session" : "<SESSION AA="44" BB="55" CC="66">session_22</SESSION>"
[event_3]
"process" : "<PROCESS A="6" B="7" C="8" D="9" E="10">process_2</PROCESS>"
"session" : "<SESSION AA="11" BB="22" CC="33">session_11</SESSION>"
[event_4]
"process" : "<PROCESS A="6" B="7" C="8" D="9" E="10">process_2</PROCESS>"
"session" : "<SESSION AA="44" BB="55" CC="66">session_22</SESSION>"
I understand that according to logstash it is expected, however, it would be awesome if someone could guide me how to achieve my initial goal
Thanks!