<?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 create a timechart plotting average values for nested JSON data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-timechart-plotting-average-values-for-nested/m-p/260548#M78154</link>
    <description>&lt;P&gt;yes ive looked at it. i can turn into string and use rex to remove outside node ids. but not sure what to do after that. &lt;/P&gt;</description>
    <pubDate>Sun, 22 May 2016 21:47:59 GMT</pubDate>
    <dc:creator>paulwrussell</dc:creator>
    <dc:date>2016-05-22T21:47:59Z</dc:date>
    <item>
      <title>How to create a timechart plotting average values for nested JSON data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-timechart-plotting-average-values-for-nested/m-p/260546#M78152</link>
      <description>&lt;P&gt;I am receiving JSON into Splunk in the following format. I'm trying to figure out how I can do searches to plot average values for this nested data. I need to be able to plot a line for each node over time, but I also need to be able to plot the average value for all nodes within a gateway over time. I don't know if I should be splitting up this data into multiple events as it comes into Splunk or whether my search should normalize all nodes to a common name as the id is in the data, and then try to split it up. Are there other options I haven't thought of yet?&lt;/P&gt;

&lt;P&gt;The list of nodes is a dynamic list, so I can't hardcode these node ids. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;gateway: "gateway1",
nodes: { 
     1002: { 
        id:  1002 
     } 
     11: {
         id:  11 
         value:  100
     } ,
     14: {
         id:  11 
         value:  120
     } 
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Help is really appreciated.&lt;/P&gt;</description>
      <pubDate>Sun, 22 May 2016 05:50:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-timechart-plotting-average-values-for-nested/m-p/260546#M78152</guid>
      <dc:creator>paulwrussell</dc:creator>
      <dc:date>2016-05-22T05:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a timechart plotting average values for nested JSON data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-timechart-plotting-average-values-for-nested/m-p/260547#M78153</link>
      <description>&lt;P&gt;Have you looked at &lt;CODE&gt;spath&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/SearchReference/Spath"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.3/SearchReference/Spath&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 22 May 2016 16:16:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-timechart-plotting-average-values-for-nested/m-p/260547#M78153</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-05-22T16:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a timechart plotting average values for nested JSON data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-timechart-plotting-average-values-for-nested/m-p/260548#M78154</link>
      <description>&lt;P&gt;yes ive looked at it. i can turn into string and use rex to remove outside node ids. but not sure what to do after that. &lt;/P&gt;</description>
      <pubDate>Sun, 22 May 2016 21:47:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-timechart-plotting-average-values-for-nested/m-p/260548#M78154</guid>
      <dc:creator>paulwrussell</dc:creator>
      <dc:date>2016-05-22T21:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a timechart plotting average values for nested JSON data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-timechart-plotting-average-values-for-nested/m-p/260549#M78155</link>
      <description>&lt;P&gt;Great. Use this to build your timechart, after you have extracted the fields. In this example, I am going to use rex (you may have to tweak the regex for your data)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | rex max_match=0 "id:\s(?&amp;lt;id&amp;gt;\s)" | rex max_match=0 "value:\s(?&amp;lt;value&amp;gt;\d+)" | eval z=mvzip(id, value) | mvexpand z | rex field=z "(?&amp;lt;id&amp;gt;\d+),(?&amp;lt;value&amp;gt;\d+) | timechart avg(value) as average by id
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 22 May 2016 22:24:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-timechart-plotting-average-values-for-nested/m-p/260549#M78155</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-05-22T22:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a timechart plotting average values for nested JSON data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-timechart-plotting-average-values-for-nested/m-p/260550#M78156</link>
      <description>&lt;P&gt;First off, the json is not valid.  it only validates after I edit it to look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
    "gateway": "gateway1",
    "nodes": {
        "1002": {
            "id": 1002,
            "value": 100
        },
        "11": {
            "id": 11,
            "value": 100
        },
        "14": {
            "id": 14,
            "value": 120
        }
    }
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Once i have it indexed with correct syntax, and sourcetype=_json, the following search works:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ...| timechart avg(nodes.*.value) AS *.value | addtotals
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You'll have to do a separate timechart for each gateway though... good use case for a dashboard with drop down selector, etc.&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2016 17:43:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-timechart-plotting-average-values-for-nested/m-p/260550#M78156</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-05-23T17:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a timechart plotting average values for nested JSON data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-timechart-plotting-average-values-for-nested/m-p/260551#M78157</link>
      <description>&lt;P&gt;spunk seriously needs some help in this place.  being able to utilize nested jsons would be really useful.  right now it kind sucks.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2016 23:51:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-timechart-plotting-average-values-for-nested/m-p/260551#M78157</guid>
      <dc:creator>shawny2005</dc:creator>
      <dc:date>2016-08-15T23:51:27Z</dc:date>
    </item>
  </channel>
</rss>

