<?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 JSON events into multiple events for search in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Expanding-nested-JSON-events-into-multiple-events-for-search/m-p/313292#M58718</link>
    <description>&lt;P&gt;Of course, question now updated&lt;/P&gt;</description>
    <pubDate>Tue, 21 Feb 2017 16:22:37 GMT</pubDate>
    <dc:creator>himynamesdave</dc:creator>
    <dc:date>2017-02-21T16:22:37Z</dc:date>
    <item>
      <title>Expanding nested JSON events into multiple events for search</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Expanding-nested-JSON-events-into-multiple-events-for-search/m-p/313289#M58715</link>
      <description>&lt;P&gt;I have nested json events indexed in Splunk. Here's an example of 2 (note confidence value differs):&lt;/P&gt;

&lt;P&gt;Event 1:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; {  [-] 
         email:  hidden@hidden.com  
         filter:     confidence &amp;gt;= 60   
         id:     2087   
         integrations:  [   [-] 
            {   [-] 
             name:   nitro  
             product:    nitro  
             product_version:    9.3    
            }   
            {   [-] 
             name:   paloaltonetworks   
             product:    paloaltonetworks   
             product_version:    3020   
            }   
        ]   
         last_intelligence:  2017-02-21T11:54:39.260329+00:00   
         title:  hidden 
         user_id:    8721   
         username:   hidden@hidden.com  
    }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Raw E1: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"username": " hidden@hidden.com", "user_id": 8721, "title": "hidden", "integrations": [{"product": "nitro", "product_version": "9.3", "name": "nitro"}, {"product": "paloaltonetworks", "product_version": "3020", "name": "paloaltonetworks"}], "email": " hidden@hidden.com", "filter": "confidence &amp;gt;= 60", "id": 2087, "last_intelligence": "2017-02-21T11:54:39.260329+00:00"}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Event 2: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{   [-] 
         email:  hidden@hidden.com  
         filter:     confidence &amp;gt;= 50   
         id:     2087   
         integrations:  [   [-] 
            {   [-] 
             name:   nitro  
             product:    nitro  
             product_version:    9.3    
            }   
            {   [-] 
             name:   paloaltonetworks   
             product:    paloaltonetworks   
             product_version:    3020   
            }   
        ]   
         last_intelligence:  2017-02-21T11:54:39.260329+00:00   
         title:  hidden 
         user_id:    8721   
         username:   hidden@hidden.com  
    }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Raw E2&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"username": " hidden@hidden.com", "user_id": 8721, "title": "hidden", "integrations": [{"product": "nitro", "product_version": "9.3", "name": "nitro"}, {"product": "paloaltonetworks", "product_version": "3020", "name": "paloaltonetworks"}], "email": " hidden@hidden.com", "filter": "confidence &amp;gt;= 50", "id": 2087, "last_intelligence": "2017-02-21T11:54:39.260329+00:00"}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Fields are extracted into fields &lt;CODE&gt;integration{}.name&lt;/CODE&gt;, &lt;CODE&gt;integration{}.product&lt;/CODE&gt;, &lt;CODE&gt;integration{}.product_version&lt;/CODE&gt;. i.e &lt;CODE&gt;integration{}.product_version=9.3&lt;/CODE&gt;, &lt;CODE&gt;integration{}.product_version=3020&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;I want to have each nested value for each represent a single event for each "integration{}.*". If we imagine this as events:&lt;/P&gt;

&lt;P&gt;Event 1A: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{   [-] 
     email:  hidden@hidden.com  
     filter:     confidence &amp;gt;= 60   
     id:     2087   
     integrations:  [   [-] 
        {   [-] 
         name:   nitro  
         product:    nitro  
         product_version:    9.3    
        }
    ]   
     last_intelligence:  2017-02-21T11:54:39.260329+00:00   
     title:  hidden 
     user_id:    8721   
     username:   hidden@hidden.com  
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Event 1B:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{   [-] 
     email:  hidden@hidden.com  
     filter:     confidence &amp;gt;= 60   
     id:     2087   
     integrations:  [   [-] 
        {   [-] 
         name:   paloaltonetworks   
         product:    paloaltonetworks   
         product_version:    3020   
        }   
    ]   
     last_intelligence:  2017-02-21T11:54:39.260329+00:00   
     title:  hidden 
     user_id:    8721   
     username:   hidden@hidden.com  
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Event 2A: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{   [-] 
     email:  hidden@hidden.com  
     filter:     confidence &amp;gt;= 50   
     id:     2087   
     integrations:  [   [-] 
        {   [-] 
         name:   nitro  
         product:    nitro  
         product_version:    9.3    
        }
    ]   
     last_intelligence:  2017-02-21T11:54:39.260329+00:00   
     title:  hidden 
     user_id:    8721   
     username:   hidden@hidden.com  
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Event 2B:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{   [-] 
     email:  hidden@hidden.com  
     filter:     confidence &amp;gt;= 50   
     id:     2087   
     integrations:  [   [-] 
        {   [-] 
         name:   paloaltonetworks   
         product:    paloaltonetworks   
         product_version:    3020   
        }   
    ]   
     last_intelligence:  2017-02-21T11:54:39.260329+00:00   
     title:  hidden 
     user_id:    8721   
     username:   hidden@hidden.com  
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am experimenting with &lt;CODE&gt;spath&lt;/CODE&gt; and &lt;CODE&gt;mvexpand&lt;/CODE&gt; searches but I am getting some odd results and behaviour using examples from previous answer threads (lots of duplicated events, mvfields, etc).&lt;/P&gt;

&lt;P&gt;Ultimately I want to  graph these events as tables like:&lt;/P&gt;

&lt;P&gt;username, user_id, id, email,title,name,product,product_version,last_intelligence,filter&lt;BR /&gt;
&lt;A href="mailto:hidden@hidden.com" target="_blank"&gt;hidden@hidden.com&lt;/A&gt;, 8721, 2087, &lt;A href="mailto:hidden@hidden.com" target="_blank"&gt;hidden@hidden.com&lt;/A&gt;, hidden, nitro, nitro, 9.3, 2017-02-21T11:54:39.260329+00:00, confidence &amp;gt;= 60&lt;BR /&gt;
&lt;A href="mailto:hidden@hidden.com" target="_blank"&gt;hidden@hidden.com&lt;/A&gt;, 8721, 2087, &lt;A href="mailto:hidden@hidden.com" target="_blank"&gt;hidden@hidden.com&lt;/A&gt;, hidden, paloaltonetworks, paloaltonetworks, 3020, 2017-02-21T11:54:39.260329+00:00, confidence &amp;gt;= 60&lt;BR /&gt;
&lt;A href="mailto:hidden@hidden.com" target="_blank"&gt;hidden@hidden.com&lt;/A&gt;, 8721, 2087, &lt;A href="mailto:hidden@hidden.com" target="_blank"&gt;hidden@hidden.com&lt;/A&gt;, hidden, nitro, nitro, 9.3, 2017-02-21T11:54:39.260329+00:00, confidence &amp;gt;= 50&lt;BR /&gt;
&lt;A href="mailto:hidden@hidden.com" target="_blank"&gt;hidden@hidden.com&lt;/A&gt;, 8721, 2087, &lt;A href="mailto:hidden@hidden.com" target="_blank"&gt;hidden@hidden.com&lt;/A&gt;, hidden, paloaltonetworks, paloaltonetworks, 3020, 2017-02-21T11:54:39.260329+00:00, confidence &amp;gt;= 50&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;One note which might be pertinent: all my events have the same timestamp (using DATETIME_CONFIG=CURRENT)&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Can anyone give me any pointers? Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:56:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Expanding-nested-JSON-events-into-multiple-events-for-search/m-p/313289#M58715</guid>
      <dc:creator>himynamesdave</dc:creator>
      <dc:date>2020-09-29T12:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: Expanding nested JSON events into multiple events for search</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Expanding-nested-JSON-events-into-multiple-events-for-search/m-p/313290#M58716</link>
      <description>&lt;P&gt;It'd help if you added a pasteable or indexable example.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 16:14:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Expanding-nested-JSON-events-into-multiple-events-for-search/m-p/313290#M58716</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2017-02-21T16:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: Expanding nested JSON events into multiple events for search</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Expanding-nested-JSON-events-into-multiple-events-for-search/m-p/313291#M58717</link>
      <description>&lt;P&gt;Oddly enough, I have had some success with  &lt;CODE&gt;| xmlkv&lt;/CODE&gt; with supposedly json rest inputs.&lt;/P&gt;

&lt;P&gt;It's worth throwing it in a quick search and seeing if some fields generate, and are more consistent. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=yourindex sourcetype=yoursourcetype source=yourfilepath | xmlkv 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You may also want to look at the raw data, and see if Splunk is inserting line breakers in the wrong places (most likely at the embedded timestamp), and only giving you partial events, or lumping multiple events together. If so, you will need to put a transforms.conf in place for the input, and wrestle with the regex that determines a newline. &lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 16:20:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Expanding-nested-JSON-events-into-multiple-events-for-search/m-p/313291#M58717</guid>
      <dc:creator>JDukeSplunk</dc:creator>
      <dc:date>2017-02-21T16:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: Expanding nested JSON events into multiple events for search</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Expanding-nested-JSON-events-into-multiple-events-for-search/m-p/313292#M58718</link>
      <description>&lt;P&gt;Of course, question now updated&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 16:22:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Expanding-nested-JSON-events-into-multiple-events-for-search/m-p/313292#M58718</guid>
      <dc:creator>himynamesdave</dc:creator>
      <dc:date>2017-02-21T16:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: Expanding nested JSON events into multiple events for search</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Expanding-nested-JSON-events-into-multiple-events-for-search/m-p/313293#M58719</link>
      <description>&lt;P&gt;Here you go:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval foo = "{\"username\": \" hidden@hidden.com\", \"user_id\": 8721, \"title\": \"hidden\", \"integrations\": [{\"product\": \"nitro\", \"product_version\": \"9.3\", \"name\": \"nitro\"}, {\"product\": \"paloaltonetworks\", \"product_version\": \"3020\", \"name\": \"paloaltonetworks\"}], \"email\": \" hidden@hidden.com\", \"filter\": \"confidence &amp;gt;= 60\", \"id\": 2087, \"last_intelligence\": \"2017-02-21T11:54:39.260329+00:00\"}
{\"username\": \" hidden@hidden.com\", \"user_id\": 8721, \"title\": \"hidden\", \"integrations\": [{\"product\": \"nitro\", \"product_version\": \"9.3\", \"name\": \"nitro\"}, {\"product\": \"paloaltonetworks\", \"product_version\": \"3020\", \"name\": \"paloaltonetworks\"}], \"email\": \" hidden@hidden.com\", \"filter\": \"confidence &amp;gt;= 50\", \"id\": 2087, \"last_intelligence\": \"2017-02-21T11:54:39.260329+00:00\"}" | makemv foo delim="
" | mvexpand foo | rename foo as _raw | spath
 | spath integrations{} | mvexpand integrations{}
 | spath input=integrations{}
 | table username, user_id, id, email,title,name,product,product_version,last_intelligence,filter
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Depending on how your sourcetype is configured, you can probably leave off the first no-parameter &lt;CODE&gt;spath&lt;/CODE&gt;, the key is &lt;CODE&gt;spath integrations{} | mvexpand integrations{} | spath input=integrations{}&lt;/CODE&gt; - extract the objects inside the array into a multivalue field, expand the field, extract each object's content.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 16:32:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Expanding-nested-JSON-events-into-multiple-events-for-search/m-p/313293#M58719</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2017-02-21T16:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: Expanding nested JSON events into multiple events for search</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Expanding-nested-JSON-events-into-multiple-events-for-search/m-p/313294#M58720</link>
      <description>&lt;P&gt;Hi Martin - thanks for taking the time to answer my question. I think I have an issue with field extraction which might be causing a problem, one event (e.g event 1 above) reports a count of 2 for each integration.* value.&lt;/P&gt;

&lt;P&gt;When I run SPATH it duplicates events:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://i.imgur.com/4XgL6Ki.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Which results in 3 values in each row&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://i.imgur.com/YpAf17p.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;And now reports a count of 6 (vs 2)&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://i.imgur.com/IU9nAST.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Now I'm really confused!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 16:54:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Expanding-nested-JSON-events-into-multiple-events-for-search/m-p/313294#M58720</guid>
      <dc:creator>himynamesdave</dc:creator>
      <dc:date>2017-02-21T16:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Expanding nested JSON events into multiple events for search</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Expanding-nested-JSON-events-into-multiple-events-for-search/m-p/313295#M58721</link>
      <description>&lt;P&gt;If your events already are configured to do the basic JSON extractions then leave off the first &lt;CODE&gt;|spath&lt;/CODE&gt;. Only use lines 4-6 from my answer, the rest is preparation of the dummy data.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 17:05:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Expanding-nested-JSON-events-into-multiple-events-for-search/m-p/313295#M58721</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2017-02-21T17:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Expanding nested JSON events into multiple events for search</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Expanding-nested-JSON-events-into-multiple-events-for-search/m-p/313296#M58722</link>
      <description>&lt;P&gt;Thanks, Martin. Works perfectly.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 10:36:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Expanding-nested-JSON-events-into-multiple-events-for-search/m-p/313296#M58722</guid>
      <dc:creator>himynamesdave</dc:creator>
      <dc:date>2017-02-22T10:36:16Z</dc:date>
    </item>
  </channel>
</rss>

