I have data in the following format, repeating each time as follows:
< Data ID="test" ShortDescription="some description" type="this is a type">
< LongDescription>this is a long description< /LongDescription>
< Values>
< Value Set="some text" AnotherType="1234"/>
< /Values>
< Identification>
< ComparisonList>
< Comparison Name="test133" AdditionalValue="260"/>
< Comparison Name="test112" AdditionalValue="124"/>
< Comparison Name="test465" AdditionalValue="624"/>
< Comparison Name="test1234" AdditionalValue="612"/>
< /ComparisonList>
< /Identification>
< /Data>
I have used file as input with following configuration:
codec => multiline {
pattern => "<(Data)"
negate => true
what => "previous"
in filter I have:
filter {
xml {
source => "message"
store_xml => false
suppress_empty => false
xpath => [
"/Data/@ID", "ID",
"/Data/@ShortDescription", "ShortDescription",
"/Data/LongDescription/text()", "LongDescription"
This works for the simple unique fields. How to do the same for the Comparison name fields, since they repeat with same name? When I try:
"/Data/Identification/ComparisonList/@Name", "Name"
I only get the first value.
I have also tried the mutate to take it out of array, but doesnt work
mutate {
rename => { "[Name[0]" => "Name" }
rename => { "[Name[1]" => "Name1" }
rename => { "[Name[2]" => "Name2" }
rename => { "[Name[3]" => "Name3" }
}