<?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 Filtering values from a JSON file in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-values-from-a-JSON-file/m-p/167587#M33916</link>
    <description>&lt;P&gt;I am trying to parse information from a json file, but am having difficulty doing this.&lt;BR /&gt;
Here is my sample json file:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;{&lt;BR /&gt;
   "message":"OK",&lt;BR /&gt;
   "status":200,&lt;BR /&gt;
   "responseEntity":[&lt;BR /&gt;
      {&lt;BR /&gt;
         "counters":{&lt;BR /&gt;
            "SearchResult.close()":{&lt;BR /&gt;
               "name":"SearchResult.close()",&lt;BR /&gt;
               "count":42,&lt;BR /&gt;
               "max":9.0,&lt;BR /&gt;
               "min":0.0&lt;BR /&gt;
            }&lt;BR /&gt;
         },&lt;BR /&gt;
         "errors":{&lt;BR /&gt;
         },&lt;BR /&gt;
         "groupDescription":"Counters",&lt;BR /&gt;
         "groupName":"Group01"&lt;BR /&gt;
      },&lt;BR /&gt;
      {&lt;BR /&gt;
         "counters":{&lt;BR /&gt;
            "SearchResult.close()":{&lt;BR /&gt;
               "name":"SearchResult.close()",&lt;BR /&gt;
               "count":7,&lt;BR /&gt;
               "max":8.0,&lt;BR /&gt;
               "min":7.0&lt;BR /&gt;
            }&lt;BR /&gt;
         },&lt;BR /&gt;
         "errors":{&lt;BR /&gt;
         },&lt;BR /&gt;
         "groupDescription":"Counters",&lt;BR /&gt;
         "groupName":"Group2"&lt;BR /&gt;
      }&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I want to be able to filter the value for "SearchResult.close().count" for groupName "group2", however I am unable to do that. I tried&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;| spath path=responseEntity{}.groupName output=groupName | mvexpand groupName |&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;But when I filter by json_group, I still get ALL values(responseEntity{}.counters.SearchResult.close().count values would be both 42, and 7)&lt;/P&gt;

&lt;P&gt;inputs.conf file&lt;BR /&gt;&lt;BR /&gt;
[monitor://\HOST01\groupInfo.json]&lt;BR /&gt;&lt;BR /&gt;
disabled = 0&lt;BR /&gt;&lt;BR /&gt;
followTail = false&lt;BR /&gt;&lt;BR /&gt;
host = HOST01&lt;BR /&gt;&lt;BR /&gt;
sourcetype = JSON Testing&lt;BR /&gt;&lt;BR /&gt;
crcSalt = &lt;SOURCE&gt;  &lt;/SOURCE&gt;&lt;/P&gt;

&lt;P&gt;props.conf file&lt;BR /&gt;&lt;BR /&gt;
[JSON Testing]&lt;BR /&gt;&lt;BR /&gt;
TRUNCATE = 0&lt;BR /&gt;&lt;BR /&gt;
KV_MODE = json  &lt;/P&gt;

&lt;P&gt;Is there a way that I can filter by groupName, then only get values that are associated with that group name, for count, max, min etc? Or is there an issue with my json file itself?&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Thu, 27 Feb 2014 01:53:31 GMT</pubDate>
    <dc:creator>lain179</dc:creator>
    <dc:date>2014-02-27T01:53:31Z</dc:date>
    <item>
      <title>Filtering values from a JSON file</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-values-from-a-JSON-file/m-p/167587#M33916</link>
      <description>&lt;P&gt;I am trying to parse information from a json file, but am having difficulty doing this.&lt;BR /&gt;
Here is my sample json file:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;{&lt;BR /&gt;
   "message":"OK",&lt;BR /&gt;
   "status":200,&lt;BR /&gt;
   "responseEntity":[&lt;BR /&gt;
      {&lt;BR /&gt;
         "counters":{&lt;BR /&gt;
            "SearchResult.close()":{&lt;BR /&gt;
               "name":"SearchResult.close()",&lt;BR /&gt;
               "count":42,&lt;BR /&gt;
               "max":9.0,&lt;BR /&gt;
               "min":0.0&lt;BR /&gt;
            }&lt;BR /&gt;
         },&lt;BR /&gt;
         "errors":{&lt;BR /&gt;
         },&lt;BR /&gt;
         "groupDescription":"Counters",&lt;BR /&gt;
         "groupName":"Group01"&lt;BR /&gt;
      },&lt;BR /&gt;
      {&lt;BR /&gt;
         "counters":{&lt;BR /&gt;
            "SearchResult.close()":{&lt;BR /&gt;
               "name":"SearchResult.close()",&lt;BR /&gt;
               "count":7,&lt;BR /&gt;
               "max":8.0,&lt;BR /&gt;
               "min":7.0&lt;BR /&gt;
            }&lt;BR /&gt;
         },&lt;BR /&gt;
         "errors":{&lt;BR /&gt;
         },&lt;BR /&gt;
         "groupDescription":"Counters",&lt;BR /&gt;
         "groupName":"Group2"&lt;BR /&gt;
      }&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I want to be able to filter the value for "SearchResult.close().count" for groupName "group2", however I am unable to do that. I tried&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;| spath path=responseEntity{}.groupName output=groupName | mvexpand groupName |&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;But when I filter by json_group, I still get ALL values(responseEntity{}.counters.SearchResult.close().count values would be both 42, and 7)&lt;/P&gt;

&lt;P&gt;inputs.conf file&lt;BR /&gt;&lt;BR /&gt;
[monitor://\HOST01\groupInfo.json]&lt;BR /&gt;&lt;BR /&gt;
disabled = 0&lt;BR /&gt;&lt;BR /&gt;
followTail = false&lt;BR /&gt;&lt;BR /&gt;
host = HOST01&lt;BR /&gt;&lt;BR /&gt;
sourcetype = JSON Testing&lt;BR /&gt;&lt;BR /&gt;
crcSalt = &lt;SOURCE&gt;  &lt;/SOURCE&gt;&lt;/P&gt;

&lt;P&gt;props.conf file&lt;BR /&gt;&lt;BR /&gt;
[JSON Testing]&lt;BR /&gt;&lt;BR /&gt;
TRUNCATE = 0&lt;BR /&gt;&lt;BR /&gt;
KV_MODE = json  &lt;/P&gt;

&lt;P&gt;Is there a way that I can filter by groupName, then only get values that are associated with that group name, for count, max, min etc? Or is there an issue with my json file itself?&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2014 01:53:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-values-from-a-JSON-file/m-p/167587#M33916</guid>
      <dc:creator>lain179</dc:creator>
      <dc:date>2014-02-27T01:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering values from a JSON file</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-values-from-a-JSON-file/m-p/167588#M33917</link>
      <description>&lt;P&gt;There is a long and storied history with this kind of use case (breaking up json data in this way).  Unfortunately, all of the solutions are as elegant as a drunken hippo in a bouncy castle.&lt;/P&gt;

&lt;P&gt;Here's something that might work:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| spath output=groupName path=responseEntity{}.groupName | rename responseEntity{}.counters.SearchResult.close().count AS count | eval x=mvzip(groupName,count)|mvexpand x|eval x=split(x,",")|eval groupName = mvindex(x,0)|eval count = mvindex(x,1)| table groupName,count &lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;What's going on here is we're zipping together the values (in order) of the two fields (with mvzip) then turning those into separate events based on the field (with mvexpand), then splitting those zipped fields into their original components (with split and mvindex).&lt;/P&gt;</description>
      <pubDate>Tue, 04 Mar 2014 01:44:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-values-from-a-JSON-file/m-p/167588#M33917</guid>
      <dc:creator>bboe</dc:creator>
      <dc:date>2014-03-04T01:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering values from a JSON file</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-values-from-a-JSON-file/m-p/167589#M33918</link>
      <description>&lt;P&gt;This worked perfectly, and when i added | where groupName="Group2" &lt;BR /&gt;
I was finally able to only get a single value!(Which is one of the things I was having a lot of trouble with)&lt;/P&gt;</description>
      <pubDate>Tue, 04 Mar 2014 18:12:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-values-from-a-JSON-file/m-p/167589#M33918</guid>
      <dc:creator>lain179</dc:creator>
      <dc:date>2014-03-04T18:12:27Z</dc:date>
    </item>
  </channel>
</rss>

