<?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 How to plot line graph against average over different time periods? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467003#M131426</link>
    <description>&lt;P&gt;We have a set of logs from different hosts that specify a metric. I want to display a line graph over a user-selectable time period that plots the metric as a percentage difference from the 30 day average for each host.&lt;/P&gt;
&lt;P&gt;That is to get the 30 day average for each host then plot (metric/average)*100)-100. This would mean that 80% would plot as -20, 100% as 0, 120% as 20, and so on. Additionally, we would like to highlight where the value falls outside -50 - 50. The next stage would be to alert if the value is outside the -50 to 50 more than the last, say 20 mins.&lt;/P&gt;
&lt;P&gt;What we are looking for is to spot where the metric is larger than average for an extended period (flood condition) or lower (drought). The range could change.&lt;/P&gt;
&lt;P&gt;I'm new to Splunk so I don't really know exactly where to start.&lt;/P&gt;
&lt;P&gt;I can get the graph to work with averaging in the same period as plotting. It's having the average over a different time period. Hosts are selected by a pattern so would be dynamic (host matching pattern &lt;EM&gt;CVM_AGG&lt;/EM&gt;). We may extend this to either a second query &lt;EM&gt;BUS_AGG&lt;/EM&gt; or merge the two &lt;EM&gt;_AGG&lt;/EM&gt;. Since we are using percentage against average they will scale the same.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jun 2020 17:52:54 GMT</pubDate>
    <dc:creator>richard_bragg</dc:creator>
    <dc:date>2020-06-08T17:52:54Z</dc:date>
    <item>
      <title>How to plot line graph against average over different time periods?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467003#M131426</link>
      <description>&lt;P&gt;We have a set of logs from different hosts that specify a metric. I want to display a line graph over a user-selectable time period that plots the metric as a percentage difference from the 30 day average for each host.&lt;/P&gt;
&lt;P&gt;That is to get the 30 day average for each host then plot (metric/average)*100)-100. This would mean that 80% would plot as -20, 100% as 0, 120% as 20, and so on. Additionally, we would like to highlight where the value falls outside -50 - 50. The next stage would be to alert if the value is outside the -50 to 50 more than the last, say 20 mins.&lt;/P&gt;
&lt;P&gt;What we are looking for is to spot where the metric is larger than average for an extended period (flood condition) or lower (drought). The range could change.&lt;/P&gt;
&lt;P&gt;I'm new to Splunk so I don't really know exactly where to start.&lt;/P&gt;
&lt;P&gt;I can get the graph to work with averaging in the same period as plotting. It's having the average over a different time period. Hosts are selected by a pattern so would be dynamic (host matching pattern &lt;EM&gt;CVM_AGG&lt;/EM&gt;). We may extend this to either a second query &lt;EM&gt;BUS_AGG&lt;/EM&gt; or merge the two &lt;EM&gt;_AGG&lt;/EM&gt;. Since we are using percentage against average they will scale the same.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 17:52:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467003#M131426</guid>
      <dc:creator>richard_bragg</dc:creator>
      <dc:date>2020-06-08T17:52:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot line graph against average over different time periods?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467004#M131427</link>
      <description>&lt;P&gt;sample:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count where index=_internal source="*metrics.log" by _time span=1h PREFIX("name=")
| rename "name=" as name
| rename COMMENT as "from here, the logic"
| bin _time span=1d
| stats sum(count) as count by _time name
| streamstats global=f window=30 avg(count) as 30days_avg by name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;visualization &amp;gt; Line Chart  with trellis by name&lt;/P&gt;

&lt;P&gt;Why don't you try the following:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;make dashboard with time picker.&lt;/LI&gt;
&lt;LI&gt;try above logic&lt;/LI&gt;
&lt;LI&gt;make percentage calculation.&lt;/LI&gt;
&lt;LI&gt;delete extra fields&lt;/LI&gt;
&lt;LI&gt;visualization&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Sun, 31 May 2020 00:53:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467004#M131427</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-31T00:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot line graph against average over different time periods?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467005#M131428</link>
      <description>&lt;P&gt;Well this chart will (if usable) fit to an existing dashboard but that bit maybe irrelevant.&lt;/P&gt;

&lt;P&gt;This is my data model&lt;BR /&gt;
index = "tivoli_omnibus_prod" sourcetype=objsvr_stats_log source=&lt;EM&gt;CVM_AGG&lt;/EM&gt; earliest=-30d@d | eventstats avg(Status_Inserts) as Inserts by Omnibus | eval percstat=(100*(Status_Inserts/Inserts))-100&lt;/P&gt;

&lt;P&gt;I know the "earliest" statement is fixing date range.&lt;/P&gt;

&lt;P&gt;Then into this report&lt;BR /&gt;
| pivot Netcool_Insert_Model RootObject avg(percstat) AS "Compare to 30 day average" SPLITROW _time AS _time PERIOD auto SPLITCOL Omnibus SORT 0 _time ROWSUMMARY 0 COLSUMMARY 0 NUMCOLS 100 SHOWOTHER 0&lt;/P&gt;

&lt;P&gt;Is this the right way to go about things?  Where does your logic fit?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:35:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467005#M131428</guid>
      <dc:creator>richard_bragg</dc:creator>
      <dc:date>2020-09-30T05:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot line graph against average over different time periods?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467006#M131429</link>
      <description>&lt;P&gt;I don't know. I can't understand pivot query.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 11:13:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467006#M131429</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-06-03T11:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot line graph against average over different time periods?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467007#M131430</link>
      <description>&lt;P&gt;This is what I get saving pivot as a report using the interface.  So it's generated by Splunk.&lt;/P&gt;

&lt;P&gt;If I view in the Pivot editor I can see two lines and it all looks fine, I can change the time period and the graph follows that selection.  &lt;/P&gt;

&lt;P&gt;If I run in Report it's all fixed at 30 days regardless of the TimePicker. &lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 11:42:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467007#M131430</guid>
      <dc:creator>richard_bragg</dc:creator>
      <dc:date>2020-06-03T11:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot line graph against average over different time periods?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467008#M131431</link>
      <description>&lt;P&gt;Adding as comment to attach examples.&lt;/P&gt;

&lt;P&gt;Pivot editor&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/9005iC93AE6A257B5AC37/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Run report&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/9006i677555B6C2FB8884/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 11:50:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467008#M131431</guid>
      <dc:creator>richard_bragg</dc:creator>
      <dc:date>2020-06-03T11:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot line graph against average over different time periods?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467009#M131432</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| tstats avg(percstat) as count from datamodel=Netcool_Insert_Model by _time Omnibus
| xyseries _time Omnibus count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Tstats"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Tstats&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Pivot"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Pivot&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 12:28:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467009#M131432</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-06-03T12:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot line graph against average over different time periods?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467010#M131433</link>
      <description>&lt;P&gt;I tried this in the Search app and get&lt;BR /&gt;
Error in 'DataModelCache': Invalid or unaccelerable root object for datamodel&lt;BR /&gt;
The search job has failed due to an error. You may be able view the job in the Job Inspector. &lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 13:19:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467010#M131433</guid>
      <dc:creator>richard_bragg</dc:creator>
      <dc:date>2020-06-03T13:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot line graph against average over different time periods?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467011#M131434</link>
      <description>&lt;P&gt;Editing DataModel to use acceleration gives&lt;/P&gt;

&lt;P&gt;You can only accelerate data models that include at least one event-based dataset or one search-based dataset that does not include streaming commands.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 13:37:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467011#M131434</guid>
      <dc:creator>richard_bragg</dc:creator>
      <dc:date>2020-06-03T13:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot line graph against average over different time periods?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467012#M131435</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| pivot Netcool_Insert_Model RootObject avg(percstat) AS "Compare to 30 day average" earliest=-4h SPLITROW _time AS _time PERIOD auto SPLITCOL Omnibus SORT 0 _time ROWSUMMARY 0 COLSUMMARY 0 NUMCOLS 100 SHOWOTHER 0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Jun 2020 19:47:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467012#M131435</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-06-03T19:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot line graph against average over different time periods?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467013#M131436</link>
      <description>&lt;P&gt;Thanks but this leads to&lt;/P&gt;

&lt;P&gt;Error in 'PivotProcessor': Error in 'PivotCell': The dataset 'RootObject' has no field 'earliest=-4h'.&lt;/P&gt;

&lt;P&gt;I'm going to see what I can play with.  Just still getting used to terms etc.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2020 09:24:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467013#M131436</guid>
      <dc:creator>richard_bragg</dc:creator>
      <dc:date>2020-06-04T09:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot line graph against average over different time periods?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467014#M131437</link>
      <description>&lt;P&gt;I don't even know the data, so it's a dead end.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2020 09:37:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467014#M131437</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-06-04T09:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot line graph against average over different time periods?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467015#M131438</link>
      <description>&lt;P&gt;Well the data is pretty simple, one file per Netcool and the lines in the log have time stamp and a number of numeric values one of which is a count of inserts.  &lt;/P&gt;

&lt;P&gt;But isn't earliest part of Splunk limiting how far back the search can go?&lt;/P&gt;

&lt;P&gt;This all works nicely in the Pivot editor but not run as a report so there must be something in the editor that obeys the data picker that's ignored in the report.&lt;/P&gt;

&lt;P&gt;What we are trying to highlight is where the inserts are outside a range around the 30 day average, that is if inserts are outside 50-150% of the average.  If too low for an extended period possible data feed issue, if too high we could be seeing a data flood that if maintained could bring system down.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2020 09:43:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-plot-line-graph-against-average-over-different-time/m-p/467015#M131438</guid>
      <dc:creator>richard_bragg</dc:creator>
      <dc:date>2020-06-04T09:43:52Z</dc:date>
    </item>
  </channel>
</rss>

