<?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: extract multivalue nested json in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397188#M70806</link>
    <description>&lt;P&gt;What is extracted and what isn't extracted? And is there supposed to be an ending &lt;CODE&gt;}&lt;/CODE&gt; that you have left off?&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jun 2018 04:46:20 GMT</pubDate>
    <dc:creator>cpetterborg</dc:creator>
    <dc:date>2018-06-20T04:46:20Z</dc:date>
    <item>
      <title>extract multivalue nested json</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397187#M70805</link>
      <description>&lt;P&gt;I have a multivalve nested json that I need to parse, auto_kv_json is enabled on my props.conf file, and it is extracting most of my key values. But for some reason, there are a few that splunk is not extracting, I can see those values if I check the raw data, but splunk won't present them to me in the results as json data. &lt;BR /&gt;
This is how my json looks:&lt;/P&gt;

&lt;P&gt;"some_name": {&lt;BR /&gt;
    "my.very.nested.json.output.some.more.strings.tomakeitcomplicated": {&lt;BR /&gt;
      "count": 1,&lt;BR /&gt;
      "max": 0.5,&lt;BR /&gt;
      "mean": 0.1,&lt;BR /&gt;
      "min": 0.092808133,&lt;BR /&gt;
      "mean_rate": 0.30310791967810413,&lt;BR /&gt;
      "duration_units": "seconds",&lt;BR /&gt;
      "rate_units": "calls/second"&lt;BR /&gt;
    },&lt;/P&gt;

&lt;P&gt;I need to extract the count, so I can present it on a table.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:06:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397187#M70805</guid>
      <dc:creator>hugo_vazquez</dc:creator>
      <dc:date>2020-09-29T20:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: extract multivalue nested json</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397188#M70806</link>
      <description>&lt;P&gt;What is extracted and what isn't extracted? And is there supposed to be an ending &lt;CODE&gt;}&lt;/CODE&gt; that you have left off?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 04:46:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397188#M70806</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2018-06-20T04:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: extract multivalue nested json</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397189#M70807</link>
      <description>&lt;P&gt;Thanks you cpetterborg.&lt;BR /&gt;
I need to extract the count, so I can present it on a table.&lt;BR /&gt;
"count": 1,&lt;/P&gt;

&lt;P&gt;You're right there's a } missing, but this is because I'm showing only a part of the entire json, which is huge.&lt;BR /&gt;
The json string is fine, splunk is extracting most of the key values, the problem is with only a few, like the one in the example I posted&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 15:52:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397189#M70807</guid>
      <dc:creator>hugo_vazquez</dc:creator>
      <dc:date>2018-06-20T15:52:03Z</dc:date>
    </item>
    <item>
      <title>Re: extract multivalue nested json</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397190#M70808</link>
      <description>&lt;P&gt;&lt;EM&gt;This is a JSON string that is in a field, not the entire event, right?&lt;/EM&gt; If that is the case, you cannot depend on Splunk to extract all the JSON fields (that could be expected if the event were only a JSON string and you configured it to be extracted that way). &lt;/P&gt;

&lt;P&gt;I would suggest doing an auto-field-extraction for the sourcetype, which will take some regular expression knowledge, or using the field extraction tool (which has its own problems, but may work fine for this case). Without knowing the entire event contents it's &lt;EM&gt;hard&lt;/EM&gt; (though not impossible) to provide a field extraction that would always work. As a quick hack at the regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"count":\s*(?P&amp;lt;count&amp;gt;\d+),
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You could use that is an auto-field-extraction, or in a rex command like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=&amp;lt;the-json-string-field-name&amp;gt; "\"count\":\s*(?P&amp;lt;count&amp;gt;\d+),"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If this is not producing good results for you, post more here about the problem.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 17:40:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397190#M70808</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2018-06-20T17:40:01Z</dc:date>
    </item>
    <item>
      <title>Re: extract multivalue nested json</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397191#M70809</link>
      <description>&lt;P&gt;This is a JSON string that is in a field, not the entire event, right?  Right&lt;BR /&gt;
Thanks for the regex, I tried it in the search bar and it will return the same results without the value I need(count=*)&lt;BR /&gt;
I also tried extracting the field with no luck.I even checked the json with an online json viewer to make sure its a valid json.&lt;BR /&gt;
What really troubles me is the fact that the result of my query won't change when I add the rex command&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 23:28:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397191#M70809</guid>
      <dc:creator>hugo_vazquez</dc:creator>
      <dc:date>2018-06-20T23:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: extract multivalue nested json</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397192#M70810</link>
      <description>&lt;P&gt;With the &lt;CODE&gt;rex&lt;/CODE&gt; embedded in your search, do you get the field &lt;CODE&gt;count&lt;/CODE&gt; having values in the events? If not, then the field is not available for you to use in your search. &lt;/P&gt;

&lt;P&gt;From your example the &lt;CODE&gt;rex&lt;/CODE&gt; I provided should extract the field &lt;CODE&gt;count&lt;/CODE&gt; (unless you are calculating another &lt;CODE&gt;count&lt;/CODE&gt; field using something like the &lt;CODE&gt;stats&lt;/CODE&gt; command).&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 23:46:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397192#M70810</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2018-06-20T23:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: extract multivalue nested json</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397193#M70811</link>
      <description>&lt;P&gt;Try This , &lt;/P&gt;

&lt;P&gt;index=yourindex  | rex field=_raw ".*?\"count\":\s(?\d+)\,"&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2018 15:57:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397193#M70811</guid>
      <dc:creator>saurabhkharkar</dc:creator>
      <dc:date>2018-12-17T15:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: extract multivalue nested json</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397194#M70812</link>
      <description>&lt;P&gt;index=yourindex | rex field=_raw ".*?\"count\":\s(?&amp;lt;_raw&amp;gt;\d+)\,"&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:29:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397194#M70812</guid>
      <dc:creator>saurabhkharkar</dc:creator>
      <dc:date>2020-09-29T22:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: extract multivalue nested json</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397195#M70813</link>
      <description>&lt;P&gt;in the regular expression replace the _raw before \d by count. Not sure why i cant type it in the search.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2018 19:53:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397195#M70813</guid>
      <dc:creator>saurabhkharkar</dc:creator>
      <dc:date>2018-12-17T19:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: extract multivalue nested json</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397196#M70814</link>
      <description>&lt;P&gt;why not using the &lt;CODE&gt;spath&lt;/CODE&gt; to traverse to the specific field in the nested &lt;CODE&gt;json&lt;/CODE&gt; in your case it should be &lt;CODE&gt;some_name."my.very.nested.json.output.some.more.strings.tomakeitcomplicated"."count"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2018 22:04:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/extract-multivalue-nested-json/m-p/397196#M70814</guid>
      <dc:creator>macadminrohit</dc:creator>
      <dc:date>2018-12-17T22:04:11Z</dc:date>
    </item>
  </channel>
</rss>

