<?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 can I parse a large JSON block with nested structures and get unique events from it? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-a-large-JSON-block-with-nested-structures-and/m-p/357921#M93375</link>
    <description>&lt;P&gt;If you ingestion is properly configured (props) all variable will be extracted automatically. &lt;/P&gt;</description>
    <pubDate>Fri, 09 Mar 2018 11:30:28 GMT</pubDate>
    <dc:creator>valiquet</dc:creator>
    <dc:date>2018-03-09T11:30:28Z</dc:date>
    <item>
      <title>How can I parse a large JSON block with nested structures and get unique events from it?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-a-large-JSON-block-with-nested-structures-and/m-p/357920#M93374</link>
      <description>&lt;P&gt;Need to be able to pull/group and dedup a number of nested JSON events where each record has a single account identifier with multiple resource identifiers. I am new to splunk and need help creating the query to be able to list the unique resource identifiers for each account Identifier. There can be multiple records for each Account identifier and multiple nested resource identifiers that may not be unique. Sample event below. I know JSON syntax is not correct just trying to give an idea of the structure&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"Message": {
                    "account_id": "423874236234",
                                         "resources": [{
                        "ResourseId": "ID1",
                    },
                    {
                        "ResourseId": "ID1",
                    },
                    {
                        "ResourseId": "ID2",
                    }]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For each JSON event, the AccountID will be singular but you can have multiple events for each Account ID.&lt;BR /&gt;
Each event will have multiple ResourceID's and the ResourceIDs can be duplicated.&lt;/P&gt;

&lt;P&gt;One more wrinkle. These are large JSON events and I had to use the path variable just to get a complete list of resource ID's out of a single event&lt;/P&gt;

&lt;P&gt;This is the query I wrote to get a list of unique resourceIDs for all events:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Index= index1 source="Stuff"    | spath output=ResourceID path=Message.resources{}.ResourceID| stats count by ResourceID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;*Names have been changed to protect the innocent * &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 15:03:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-a-large-JSON-block-with-nested-structures-and/m-p/357920#M93374</guid>
      <dc:creator>a238574</dc:creator>
      <dc:date>2018-02-06T15:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: How can I parse a large JSON block with nested structures and get unique events from it?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-a-large-JSON-block-with-nested-structures-and/m-p/357921#M93375</link>
      <description>&lt;P&gt;If you ingestion is properly configured (props) all variable will be extracted automatically. &lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 11:30:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-parse-a-large-JSON-block-with-nested-structures-and/m-p/357921#M93375</guid>
      <dc:creator>valiquet</dc:creator>
      <dc:date>2018-03-09T11:30:28Z</dc:date>
    </item>
  </channel>
</rss>

