<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to break nested objects and lists into individual events? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-nested-objects-and-lists-into-individual-events/m-p/585804#M204093</link>
    <description>&lt;P&gt;First of all, please post sample data in text, not in screenshot. &amp;nbsp;It is much easier for other people to help.&lt;/P&gt;&lt;P&gt;Secondly, the screenshot shows invalid JSON syntax.&lt;/P&gt;&lt;P&gt;Assuming actual data are conformant, the following should give you the desired outcome&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath path=group_name
| spath output=sub_groups path=group.sub_groups{}
| mvexpand sub_groups
| spath input=sub_groups path=subgroup
| spath input=sub_groups output=subsubgroup path=subsubgroup{}
| fields - sub_groups ``` just to clear view, not part of calculation ```
| mvexpand subsubgroup
| spath input=subsubgroup
| table group_name subgroup team "some other info"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the above, I didn't bother to rename fields; for example, "team" is subsubgroup, etc. &amp;nbsp;In input data, I assumed that there is a field "some other info" under subsubgroup.&lt;/P&gt;&lt;P&gt;Given test data as follows (which you should have supplied in text):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{"event":"A",
  "group_name":"alpha",
  "group":{
    "group_name":"alpha",
    "sub_groups":[
     {"subgroup":"alpha1",
      "subsubgroup": [
        {"team":"beta"},
        {"team":"gamma", "some other info":"foo"}]
     },
     {"subgroup":"alpha2",
      "subsubgroup": [
       {"team":"a"},
       {"team":"b", "some other info":"bar"}]
     },
     {"subgroup": "alpha3",
      "subsubgroup": [
       {"team": "uno", "some other info":"baz"}]
     }
   ]
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;output would be&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;group_name&lt;/TD&gt;&lt;TD&gt;subgroup&lt;/TD&gt;&lt;TD&gt;team&lt;/TD&gt;&lt;TD&gt;some other info&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;alpha&lt;/TD&gt;&lt;TD&gt;alpha1&lt;/TD&gt;&lt;TD&gt;beta&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;alpha&lt;/TD&gt;&lt;TD&gt;alpha1&lt;/TD&gt;&lt;TD&gt;gamma&lt;/TD&gt;&lt;TD&gt;foo&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;alpha&lt;/TD&gt;&lt;TD&gt;alpha2&lt;/TD&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;alpha&lt;/TD&gt;&lt;TD&gt;alpha2&lt;/TD&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;TD&gt;bar&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;alpha&lt;/TD&gt;&lt;TD&gt;alpha3&lt;/TD&gt;&lt;TD&gt;uno&lt;/TD&gt;&lt;TD&gt;baz&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
    <pubDate>Sat, 19 Feb 2022 09:18:06 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2022-02-19T09:18:06Z</dc:date>
    <item>
      <title>How to break nested objects and lists into individual events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-nested-objects-and-lists-into-individual-events/m-p/585723#M204072</link>
      <description>&lt;P&gt;I have an event with multiple levels of nested objects and lists, that I need to break down into individual events. For example, a single event can look like:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dasaed_0-1645198215353.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/18034iFE2241BFB007714A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dasaed_0-1645198215353.png" alt="dasaed_0-1645198215353.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I need to conver that event into a table like this:&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="125"&gt;
&lt;P&gt;Group_name&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="125"&gt;
&lt;P&gt;Sub_group&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="125"&gt;
&lt;P&gt;Subsubgroup&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="125"&gt;
&lt;P&gt;Some other info …&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="125"&gt;
&lt;P&gt;alpha&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="125"&gt;
&lt;P&gt;alpha1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="125"&gt;
&lt;P&gt;beta&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="125"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="125"&gt;
&lt;P&gt;alpha&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="125"&gt;
&lt;P&gt;alpha1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="125"&gt;
&lt;P&gt;gamma&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="125"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="125"&gt;
&lt;P&gt;alpha&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="125"&gt;
&lt;P&gt;alpha2&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="125"&gt;
&lt;P&gt;a&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="125"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="125"&gt;
&lt;P&gt;alpha&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="125"&gt;
&lt;P&gt;alpha2&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="125"&gt;
&lt;P&gt;b&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="125"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="125"&gt;
&lt;P&gt;alpha&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="125"&gt;
&lt;P&gt;alpha3&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="125"&gt;
&lt;P&gt;uno&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="125"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've tried multiple combinations of mvexpand, table, and stats, but I keep getting erroneous results. The command flatten doesn't seem to work, and I fear I might need some crazy regex to parse all the embedded objects and list of objects, not to mention this is only one event, in reality I would have multiple other groups with their corresponding subgroups and stuff.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 16:07:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-break-nested-objects-and-lists-into-individual-events/m-p/585723#M204072</guid>
      <dc:creator>dasaed</dc:creator>
      <dc:date>2022-02-18T16:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to break nested objects and lists into individual events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-nested-objects-and-lists-into-individual-events/m-p/585804#M204093</link>
      <description>&lt;P&gt;First of all, please post sample data in text, not in screenshot. &amp;nbsp;It is much easier for other people to help.&lt;/P&gt;&lt;P&gt;Secondly, the screenshot shows invalid JSON syntax.&lt;/P&gt;&lt;P&gt;Assuming actual data are conformant, the following should give you the desired outcome&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath path=group_name
| spath output=sub_groups path=group.sub_groups{}
| mvexpand sub_groups
| spath input=sub_groups path=subgroup
| spath input=sub_groups output=subsubgroup path=subsubgroup{}
| fields - sub_groups ``` just to clear view, not part of calculation ```
| mvexpand subsubgroup
| spath input=subsubgroup
| table group_name subgroup team "some other info"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the above, I didn't bother to rename fields; for example, "team" is subsubgroup, etc. &amp;nbsp;In input data, I assumed that there is a field "some other info" under subsubgroup.&lt;/P&gt;&lt;P&gt;Given test data as follows (which you should have supplied in text):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{"event":"A",
  "group_name":"alpha",
  "group":{
    "group_name":"alpha",
    "sub_groups":[
     {"subgroup":"alpha1",
      "subsubgroup": [
        {"team":"beta"},
        {"team":"gamma", "some other info":"foo"}]
     },
     {"subgroup":"alpha2",
      "subsubgroup": [
       {"team":"a"},
       {"team":"b", "some other info":"bar"}]
     },
     {"subgroup": "alpha3",
      "subsubgroup": [
       {"team": "uno", "some other info":"baz"}]
     }
   ]
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;output would be&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;group_name&lt;/TD&gt;&lt;TD&gt;subgroup&lt;/TD&gt;&lt;TD&gt;team&lt;/TD&gt;&lt;TD&gt;some other info&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;alpha&lt;/TD&gt;&lt;TD&gt;alpha1&lt;/TD&gt;&lt;TD&gt;beta&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;alpha&lt;/TD&gt;&lt;TD&gt;alpha1&lt;/TD&gt;&lt;TD&gt;gamma&lt;/TD&gt;&lt;TD&gt;foo&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;alpha&lt;/TD&gt;&lt;TD&gt;alpha2&lt;/TD&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;alpha&lt;/TD&gt;&lt;TD&gt;alpha2&lt;/TD&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;TD&gt;bar&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;alpha&lt;/TD&gt;&lt;TD&gt;alpha3&lt;/TD&gt;&lt;TD&gt;uno&lt;/TD&gt;&lt;TD&gt;baz&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Sat, 19 Feb 2022 09:18:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-break-nested-objects-and-lists-into-individual-events/m-p/585804#M204093</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-02-19T09:18:06Z</dc:date>
    </item>
  </channel>
</rss>

