<?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: Help extracting totalCount out of nested JSON in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-extracting-totalCount-out-of-nested-JSON/m-p/501994#M139737</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw = "{ 
    \"detailMap\": { 
      \"critical\": \"false\",
      \"result\": \"0\",
      \"totalCnt\": \"5\",
      \"txnCountWithIgnoredIRC\": \"0\",
      \"warning\": \"false\"
    },
    \"id\": \"60300000000\",
    \"name\": \"EBALL\"
 }"
| spath
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;From this results,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="pas" source="agent.log" 
| spath output=myCount path=detailMap.totalCnt 
| table myCount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It looks like the field name is different.&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jan 2020 23:50:25 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-01-01T23:50:25Z</dc:date>
    <item>
      <title>Help extracting totalCount out of nested JSON</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-extracting-totalCount-out-of-nested-JSON/m-p/501992#M139735</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;{ [-]
   detailMap: { [-]
     critical: false
     result: 0
     totalCnt: 5
     txnCountWithIgnoredIRC: 0
     warning: false
   }
   id: 60300000000
   name: EBALL
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm trying to extract totalCount out of the nested Json. I'm trying the below search to extract it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="pas" source="agent.log" | spath output=myCount path=detailMap{}.totalCnt | table myCount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When I'm running this search, myCount column is blank.&lt;BR /&gt;
Please let me know how to improvise this search.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 23:09:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-extracting-totalCount-out-of-nested-JSON/m-p/501992#M139735</guid>
      <dc:creator>bhavya49</dc:creator>
      <dc:date>2019-12-05T23:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help extracting totalCount out of nested JSON</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-extracting-totalCount-out-of-nested-JSON/m-p/501993#M139736</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval temp="{
  \"detailMap\": {
    \"critical\": false,
    \"result\": 0,
    \"totalCnt\": 5,
    \"txnCountWithIgnoredIRC\": 0,
    \"warning\": false
  },
  \"id\": 60300000000,
  \"name\": \"EBALL\"
        }" 
| spath input=temp output=totalCnt path=detailMap{}.totalCnt | table totalCnt
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Dec 2019 02:53:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-extracting-totalCount-out-of-nested-JSON/m-p/501993#M139736</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-12-06T02:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: Help extracting totalCount out of nested JSON</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-extracting-totalCount-out-of-nested-JSON/m-p/501994#M139737</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw = "{ 
    \"detailMap\": { 
      \"critical\": \"false\",
      \"result\": \"0\",
      \"totalCnt\": \"5\",
      \"txnCountWithIgnoredIRC\": \"0\",
      \"warning\": \"false\"
    },
    \"id\": \"60300000000\",
    \"name\": \"EBALL\"
 }"
| spath
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;From this results,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="pas" source="agent.log" 
| spath output=myCount path=detailMap.totalCnt 
| table myCount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It looks like the field name is different.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jan 2020 23:50:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-extracting-totalCount-out-of-nested-JSON/m-p/501994#M139737</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-01T23:50:25Z</dc:date>
    </item>
  </channel>
</rss>

