<?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: Expanding nested events in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Expanding-nested-events/m-p/330731#M98439</link>
    <description>&lt;P&gt;You can find some useful sample in below document,&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/SplunkCloud/7.0.0/SearchReference/Spath"&gt;http://docs.splunk.com/Documentation/SplunkCloud/7.0.0/SearchReference/Spath&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;And try like this,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index= &amp;lt;your_own_search&amp;gt; | spath |rename Projects{}.Tasks{}.TaskDueDate AS x, Projects{}.ProjectName AS y, Projects{}.Tasks{}.TaskName AS z |eval joinfield = mvzip(x,mvzip(y,z)) |mvexpand joinfield |eval Name=mvindex(FirstName,0) +" "+mvindex(LastName,0) | eval spjoinfield = split(joinfield,",") | eval Date=mvindex(spjoinfield ,0) | eval ProjectName=mvindex(spjoinfield ,1)| eval TaskName=mvindex(spjoinfield ,2)|table Name ProjectName TaskName Date
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I hope this helps.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Mar 2018 04:42:28 GMT</pubDate>
    <dc:creator>miyamaet</dc:creator>
    <dc:date>2018-03-06T04:42:28Z</dc:date>
    <item>
      <title>Expanding nested events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Expanding-nested-events/m-p/330730#M98438</link>
      <description>&lt;P&gt;Let's say I have an event that looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
  FirstName: John
  LastName: Doe
  Projects: [
    {
      ProjectName: Build Computer
      Tasks: [
        {
          TaskName: Order hardware
          TaskDueDate: 1/1/2018
        }
        {
          TaskName: Install software
          TaskDueDate: 1/2/2018
        }
      ]
    }
    {
      ProjectName: Submit Timesheet
      Tasks: [
        {
          TaskName: Fill out Timesheet
          TaskDueDate: 2/1/2018
        }
        {
          TaskName: Email Timesheet
          TaskDueDate: 2/2/2018
        }
      ]
    }
  ]
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am trying to format a table that ultimately combines these elements like this for a single event:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;FirstName LastName  ProjectName       TaskName           TaskDueDate
John      Doe       Build Computer    Order hardware     1/1/2018
John      Doe       Build Computer    Install software   1/2/2018
John      Doe       Submit Timesheet  Fill out Timesheet 2/1/2018
John      Doe       Email Timesheet   Email Timesheet    2/2/2018
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have been playing around with mvexand which lets me get the Projects level organized, but I do not know how to continue this into the Tasks level.  Would someone be able to point me in the correct direction?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 00:22:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Expanding-nested-events/m-p/330730#M98438</guid>
      <dc:creator>BearMormont</dc:creator>
      <dc:date>2018-03-06T00:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: Expanding nested events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Expanding-nested-events/m-p/330731#M98439</link>
      <description>&lt;P&gt;You can find some useful sample in below document,&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/SplunkCloud/7.0.0/SearchReference/Spath"&gt;http://docs.splunk.com/Documentation/SplunkCloud/7.0.0/SearchReference/Spath&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;And try like this,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index= &amp;lt;your_own_search&amp;gt; | spath |rename Projects{}.Tasks{}.TaskDueDate AS x, Projects{}.ProjectName AS y, Projects{}.Tasks{}.TaskName AS z |eval joinfield = mvzip(x,mvzip(y,z)) |mvexpand joinfield |eval Name=mvindex(FirstName,0) +" "+mvindex(LastName,0) | eval spjoinfield = split(joinfield,",") | eval Date=mvindex(spjoinfield ,0) | eval ProjectName=mvindex(spjoinfield ,1)| eval TaskName=mvindex(spjoinfield ,2)|table Name ProjectName TaskName Date
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I hope this helps.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 04:42:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Expanding-nested-events/m-p/330731#M98439</guid>
      <dc:creator>miyamaet</dc:creator>
      <dc:date>2018-03-06T04:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Expanding nested events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Expanding-nested-events/m-p/330732#M98440</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;
How you get  Projects level ? Can you share query your are using?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 09:59:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Expanding-nested-events/m-p/330732#M98440</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2018-03-06T09:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: Expanding nested events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Expanding-nested-events/m-p/330733#M98441</link>
      <description>&lt;P&gt;It does help quite a great deal, thanks!&lt;/P&gt;

&lt;P&gt;I do have one follow up question.  It seems to work when each project has exactly two tasks, but let's say the second project (Submit Timesheet) had a third task added (Get paid) while the first project (Build Computer) stayed the way it is.&lt;/P&gt;

&lt;P&gt;In the output I only see the first two tasks for the second project; the third just drops off.  I have no way to know exactly how many tasks any given project will have ahead of time.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 14:08:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Expanding-nested-events/m-p/330733#M98441</guid>
      <dc:creator>BearMormont</dc:creator>
      <dc:date>2018-03-06T14:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: Expanding nested events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Expanding-nested-events/m-p/330734#M98442</link>
      <description>&lt;P&gt;Not really.  This is more a made up example that is similar to my production data.  But the query is really just an index statement.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 15:03:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Expanding-nested-events/m-p/330734#M98442</guid>
      <dc:creator>BearMormont</dc:creator>
      <dc:date>2018-03-06T15:03:45Z</dc:date>
    </item>
  </channel>
</rss>

