Getting Data In

How to return xml grouped by parent element?

sboogaar
Path Finder

I want to convert my _raw xml data in a query to a list of parent with an mv field of children.
Lets say the structure looks like this:

<elements>
   <element>
     <name>element one</name>
     <items>
         <item> 1   </item>
         <item> 2   </item>
         <item> 3   </item>
     </items>    
   </element>

   <element>
     <name>element two</name>
     <items>
         <item> 4   </item>
         <item> 9   </item>
     </items>    
   </element>
</elements>

What I try to get as a result is a table like:

element name                          items
--------------------------------------------------------------------------------
element one        |                 1
                   |                 2
                   |                 3
--------------------------------------------------------------------------------
element two        |                 4
                   |                 9
--------------------------------------------------------------------------------

Where items is a multi value field.
I tried using spath this gives me a list of the elements, but I cant get the items to be grouped by the element name.
Any help is welcome 🙂

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...