<?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 Plotting 2 week moving average for response data in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Plotting-2-week-moving-average-for-response-data/m-p/51948#M12617</link>
    <description>&lt;P&gt;I am plotting reponse time data using the following search&lt;/P&gt;

&lt;P&gt;sourcetype="jboss" TOTAL SEARCH TIME CAREWEB AND NOT PMR | eval rp=EASYDOC_JBOSS_TIME/1000 | timechart span="1h" avg(rp)&lt;/P&gt;

&lt;P&gt;Is is possible to plot 2 week moving average  as a base line with this chart &lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 11:49:23 GMT</pubDate>
    <dc:creator>kunadkat</dc:creator>
    <dc:date>2020-09-28T11:49:23Z</dc:date>
    <item>
      <title>Plotting 2 week moving average for response data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Plotting-2-week-moving-average-for-response-data/m-p/51948#M12617</link>
      <description>&lt;P&gt;I am plotting reponse time data using the following search&lt;/P&gt;

&lt;P&gt;sourcetype="jboss" TOTAL SEARCH TIME CAREWEB AND NOT PMR | eval rp=EASYDOC_JBOSS_TIME/1000 | timechart span="1h" avg(rp)&lt;/P&gt;

&lt;P&gt;Is is possible to plot 2 week moving average  as a base line with this chart &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:49:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Plotting-2-week-moving-average-for-response-data/m-p/51948#M12617</guid>
      <dc:creator>kunadkat</dc:creator>
      <dc:date>2020-09-28T11:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting 2 week moving average for response data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Plotting-2-week-moving-average-for-response-data/m-p/51949#M12618</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;sourcetype="jboss" TOTAL SEARCH TIME CAREWEB AND NOT PMR earliest=-24h@h latest=@h | 
eval rp=EASYDOC_JBOSS_TIME/1000 | 
bucket _time span=1h |
stats avg(rp) as avgRP by _time |
eval series = "average RP" |
append [ search 
sourcetype="jboss" TOTAL SEARCH TIME CAREWEB AND NOT PMR earliest=-29d latest=@h | 
eval rp=EASYDOC_JBOSS_TIME/1000 | 
timechart count span=1h | 
streamstats window=168 avg(rp) as avgRP |
eval series = "moving avg RP" |
fields _time, avgRP, series ] |
where _time &amp;gt; relative_time(now(),"-24h@h") |
timechart span=1h max(avgRP) as "Average RP" by series
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;There are some dates in this search that you probably need to adjust:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;CODE&gt;window=168&lt;/CODE&gt; because 2 weeks = 7*24 hours = 168 hours, so thats what streamstats needs to compute the moving average. You may not need to change this.&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;earliest=-24h@h&lt;/CODE&gt; in the first search. I just wanted to make the search time range explicit, so that the whole search makes sense. You could use the dropdown time range picker in the UI instead. But if you choose a different time range, you will definitely need to adjust the remaining time ranges in this list&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;earliest=-16d&lt;/CODE&gt; in the inner search. This should be set to at least 2 weeks + the time period in the first search. You may want to play with this a bit; i added an extra day to avoid having to worry about partial days.&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;where _time &amp;gt; relative_time(now(),"-24h@h")&lt;/CODE&gt;  - this statement eliminates the extra events that are created by the inner search while computing the rolling average. The &lt;CODE&gt;-24h@h&lt;/CODE&gt; must be the same time range as in the first search.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;By default, the inner search will run over all time, so you really do need to constrain the time range of the inner search. &lt;/P&gt;

&lt;P&gt;Let me know if this works!&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2012 21:43:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Plotting-2-week-moving-average-for-response-data/m-p/51949#M12618</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-05-15T21:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting 2 week moving average for response data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Plotting-2-week-moving-average-for-response-data/m-p/51950#M12619</link>
      <description>&lt;P&gt;I am getting an error for the following line. It is complaining that "Error in 'eval' command: The operator at 'fields _time avgRP, series' is invalid"&lt;/P&gt;

&lt;P&gt;eval series = "moving avg RP"&lt;BR /&gt;
fields _time, avgRP, series  &lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Wed, 16 May 2012 02:09:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Plotting-2-week-moving-average-for-response-data/m-p/51950#M12619</guid>
      <dc:creator>kunadkat</dc:creator>
      <dc:date>2012-05-16T02:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting 2 week moving average for response data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Plotting-2-week-moving-average-for-response-data/m-p/51951#M12620</link>
      <description>&lt;P&gt;Oops, missing a pipe! I edited my answer above.&lt;/P&gt;</description>
      <pubDate>Wed, 16 May 2012 18:38:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Plotting-2-week-moving-average-for-response-data/m-p/51951#M12620</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-05-16T18:38:50Z</dc:date>
    </item>
  </channel>
</rss>

