<?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 to edit my search to parse a JSON array and chart values for different components over time? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-parse-a-JSON-array-and-chart-values-for/m-p/268862#M80862</link>
    <description>&lt;P&gt;Thanks, this works perfectly &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 17 Dec 2016 00:15:21 GMT</pubDate>
    <dc:creator>jwair</dc:creator>
    <dc:date>2016-12-17T00:15:21Z</dc:date>
    <item>
      <title>How to edit my search to parse a JSON array and chart values for different components over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-parse-a-JSON-array-and-chart-values-for/m-p/268860#M80860</link>
      <description>&lt;P&gt;I have a periodic event with a JSON array that holds some values for different items. I would like to chart one of these values (per component) vs time&lt;/P&gt;

&lt;P&gt;E.g.&lt;BR /&gt;
One event would looks something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[
  {
    "name": "ABC",
    "data": {
      "a": 1,
      "b": 5
    }
  },
  {
    "name": "XYZ",
    "data": {
      "a": 2,
      "b": 7
    }
  }
]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The values for a and b change in consequent events, but the structure stays the same.&lt;/P&gt;

&lt;P&gt;I would like to chart the values of 'a' for different components. A final output would look like this:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2218iB50A5CC57078EE1C/image-size/large?v=v2&amp;amp;px=999" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I used 'spath' to parse the JSON array, and I was able to pull the 'name' values and 'a' values, but there were two problems. I could not correlate which value corresponded to which 'name', and when I made a table of the parsed values I got all the 'name' values and all 'a' values in one row corresponding to the event. I might be taking the wrong approach here, but this is what I have:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| ...
| spath input=myField
| rename {}.name AS name, {}.data.a AS a
| table name, a
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Could you please help me create the search string to make the chart described above?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2016 16:28:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-parse-a-JSON-array-and-chart-values-for/m-p/268860#M80860</guid>
      <dc:creator>jwair</dc:creator>
      <dc:date>2016-12-08T16:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to parse a JSON array and chart values for different components over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-parse-a-JSON-array-and-chart-values-for/m-p/268861#M80861</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| ...
 | spath input=myField
 | rename {}.name AS name, {}.data.a AS a | eval temp=mvzip(name,a,"#")
| mvexpand temp | rex field=temp "(?&amp;lt;name&amp;gt;[^#]+)#(?&amp;lt;a&amp;gt;.+)" | fields - temp
 | table name, a
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Dec 2016 19:43:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-parse-a-JSON-array-and-chart-values-for/m-p/268861#M80861</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-12-08T19:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to parse a JSON array and chart values for different components over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-parse-a-JSON-array-and-chart-values-for/m-p/268862#M80862</link>
      <description>&lt;P&gt;Thanks, this works perfectly &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Dec 2016 00:15:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-parse-a-JSON-array-and-chart-values-for/m-p/268862#M80862</guid>
      <dc:creator>jwair</dc:creator>
      <dc:date>2016-12-17T00:15:21Z</dc:date>
    </item>
  </channel>
</rss>

