<?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 Grouping JSON data and creating dynamic chart in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Grouping-JSON-data-and-creating-dynamic-chart/m-p/180830#M36265</link>
    <description>&lt;P&gt;Hi experts,&lt;/P&gt;

&lt;P&gt;I am trying to create a dashboard from my data, which is logged in JSON format. However, I am stuck with getting sub-elements from the JSON as lines in my chart.&lt;/P&gt;

&lt;P&gt;Here is a sample log:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{ [-] 
    DataThroughput: { [-] 
      Updates per second:  576.0666666666667 
      Incoming Requests per second:  388.7 
      Processed Requests per second:  382.35 
   } 
    DeploymentId:  c84e3e1fe4f74408876bea1a9f6c60e1 
    LogLevel:  Info 
    LogTime:  2015-05-05T14:51:37.5168234+00:00 
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get one of these every minute into splunk. My ultimate goal is to have a timechart over the data throughput of my system, i.e.:&lt;/P&gt;

&lt;P&gt;X-Axis: The time (say over the last 1h)&lt;BR /&gt;
Y-Axis: The average throughput per second&lt;/P&gt;

&lt;P&gt;In this example, the timechart would have three lines (one for Updates / s, one for Incoming Requests / s and one for Processed Requests / s).&lt;/P&gt;

&lt;P&gt;Now I know how to do this for this static case, but in my real world scenario, the number of children under the node "DataThroughput" and their names is unknown and changes frequently. Is there a clever way to extract all children of the "DataThroughput" node in the JSON data and build a line in a timechart for each of them without specifying them directly?&lt;/P&gt;

&lt;P&gt;Thanks a lot,&lt;BR /&gt;
Christian&lt;/P&gt;</description>
    <pubDate>Tue, 05 May 2015 15:00:39 GMT</pubDate>
    <dc:creator>MemoreX42</dc:creator>
    <dc:date>2015-05-05T15:00:39Z</dc:date>
    <item>
      <title>Grouping JSON data and creating dynamic chart</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Grouping-JSON-data-and-creating-dynamic-chart/m-p/180830#M36265</link>
      <description>&lt;P&gt;Hi experts,&lt;/P&gt;

&lt;P&gt;I am trying to create a dashboard from my data, which is logged in JSON format. However, I am stuck with getting sub-elements from the JSON as lines in my chart.&lt;/P&gt;

&lt;P&gt;Here is a sample log:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{ [-] 
    DataThroughput: { [-] 
      Updates per second:  576.0666666666667 
      Incoming Requests per second:  388.7 
      Processed Requests per second:  382.35 
   } 
    DeploymentId:  c84e3e1fe4f74408876bea1a9f6c60e1 
    LogLevel:  Info 
    LogTime:  2015-05-05T14:51:37.5168234+00:00 
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get one of these every minute into splunk. My ultimate goal is to have a timechart over the data throughput of my system, i.e.:&lt;/P&gt;

&lt;P&gt;X-Axis: The time (say over the last 1h)&lt;BR /&gt;
Y-Axis: The average throughput per second&lt;/P&gt;

&lt;P&gt;In this example, the timechart would have three lines (one for Updates / s, one for Incoming Requests / s and one for Processed Requests / s).&lt;/P&gt;

&lt;P&gt;Now I know how to do this for this static case, but in my real world scenario, the number of children under the node "DataThroughput" and their names is unknown and changes frequently. Is there a clever way to extract all children of the "DataThroughput" node in the JSON data and build a line in a timechart for each of them without specifying them directly?&lt;/P&gt;

&lt;P&gt;Thanks a lot,&lt;BR /&gt;
Christian&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2015 15:00:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Grouping-JSON-data-and-creating-dynamic-chart/m-p/180830#M36265</guid>
      <dc:creator>MemoreX42</dc:creator>
      <dc:date>2015-05-05T15:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping JSON data and creating dynamic chart</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Grouping-JSON-data-and-creating-dynamic-chart/m-p/180831#M36266</link>
      <description>&lt;P&gt;So first, you want to extract all the data in the specific node - one way of doing that is by using two &lt;CODE&gt;spath&lt;/CODE&gt; commands. You'll need to use the &lt;CODE&gt;fields&lt;/CODE&gt; command too, in order to make sure those are the only fields that we dealing with.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| spath DataThroughput
| fields DataThroughput
| spath input=DataThroughput
| timechart avg(*) as *
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now you can add span to timechart to adjust the sampling interval (e.g. &lt;CODE&gt;timechart span=15m avg(*) as *&lt;/CODE&gt; and obviously tweak the time range to whatever you need (you had mentioned over the last hour). If you don't use the span option of timechart, it will just set your sampling interval automatically. &lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2015 17:51:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Grouping-JSON-data-and-creating-dynamic-chart/m-p/180831#M36266</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-05-05T17:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping JSON data and creating dynamic chart</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Grouping-JSON-data-and-creating-dynamic-chart/m-p/180832#M36267</link>
      <description>&lt;P&gt;Thanks, this works just the way I wanted it, thanks a lot!&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2015 07:49:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Grouping-JSON-data-and-creating-dynamic-chart/m-p/180832#M36267</guid>
      <dc:creator>MemoreX42</dc:creator>
      <dc:date>2015-05-06T07:49:14Z</dc:date>
    </item>
  </channel>
</rss>

