<?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 calculate moving average and graph it as an overlay on a bar chart of actual values? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127077#M34443</link>
    <description>&lt;P&gt;No you are misunderstanding the way these averages are calculated. Point 7 will be the average of points 1-7 but point 8 is the average of 2-8, point 9 is the average of 3-9 and so on. Point 14 is 8-14 but there are 6 points between 7 and 14 giving the jerky appearance.&lt;/P&gt;</description>
    <pubDate>Tue, 18 Nov 2014 22:39:01 GMT</pubDate>
    <dc:creator>bmunson_splunk</dc:creator>
    <dc:date>2014-11-18T22:39:01Z</dc:date>
    <item>
      <title>How to calculate moving average and graph it as an overlay on a bar chart of actual values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127072#M34438</link>
      <description>&lt;P&gt;I am trying to calculate a moving average and overlay those values on a bar chart of actual values.  This is what I have:&lt;/P&gt;

&lt;P&gt;| streamstats window=7 avg(Value) AS AvgValue | chart values(AvgValue) AS "Moving Average", values(Value) AS "Actual Value" by _time&lt;/P&gt;

&lt;P&gt;The window function doesn't seem to be working.  Every point has a different value for moving average; it should be every 7 points, unless I am misunderstanding how splunk is calculating the value.&lt;/P&gt;

&lt;P&gt;Any suggestions would be great! Regards.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Nov 2014 21:09:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127072#M34438</guid>
      <dc:creator>krwinters11</dc:creator>
      <dc:date>2014-11-18T21:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate moving average and graph it as an overlay on a bar chart of actual values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127073#M34439</link>
      <description>&lt;P&gt;It looks like a central moving average would use a window with the point in the center.  I'm not sure splunk is doing this(?). It looks as though it is calculating the average using all data up to that point. which is why it is different for each point. &lt;A href="http://en.wikipedia.org/wiki/Moving_average"&gt;http://en.wikipedia.org/wiki/Moving_average&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Nov 2014 21:17:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127073#M34439</guid>
      <dc:creator>krwinters11</dc:creator>
      <dc:date>2014-11-18T21:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate moving average and graph it as an overlay on a bar chart of actual values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127074#M34440</link>
      <description>&lt;P&gt;Sounds like you're looking for &lt;CODE&gt;trendline&lt;/CODE&gt;. See the docs &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.0/SearchReference/Trendline"&gt;here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Nov 2014 21:28:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127074#M34440</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2014-11-18T21:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate moving average and graph it as an overlay on a bar chart of actual values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127075#M34441</link>
      <description>&lt;P&gt;streamstats and trendline can both create moving averages but they do not reduce the granularity of the line. It will still look as "jerky" but they are accurate averages. Increasing the window will make it look smoother.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest=-24h@h sourcetype=access*| timechart  span=10m sum(bytes) as bytes | streamstats avg(bytes) as av1 window=5 | streamstats avg(bytes) as av2 window=50
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Nov 2014 22:11:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127075#M34441</guid>
      <dc:creator>bmunson_splunk</dc:creator>
      <dc:date>2014-11-18T22:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate moving average and graph it as an overlay on a bar chart of actual values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127076#M34442</link>
      <description>&lt;P&gt;trendline seems to react the same as the stream stats function above&lt;BR /&gt;
still jerky like bmunson_splunk mentioned in the above comment.  Unless I am misunderstanding the way that Splunk is calculating, it should be averaging 7 points and the 14 and then 21 so the plots should only be every 7 events.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Nov 2014 22:21:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127076#M34442</guid>
      <dc:creator>krwinters11</dc:creator>
      <dc:date>2014-11-18T22:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate moving average and graph it as an overlay on a bar chart of actual values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127077#M34443</link>
      <description>&lt;P&gt;No you are misunderstanding the way these averages are calculated. Point 7 will be the average of points 1-7 but point 8 is the average of 2-8, point 9 is the average of 3-9 and so on. Point 14 is 8-14 but there are 6 points between 7 and 14 giving the jerky appearance.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Nov 2014 22:39:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127077#M34443</guid>
      <dc:creator>bmunson_splunk</dc:creator>
      <dc:date>2014-11-18T22:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate moving average and graph it as an overlay on a bar chart of actual values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127078#M34444</link>
      <description>&lt;P&gt;If all you want is a smoother graph, that can be achieved with an average of averages. It is mathematically questionable but does reduce the jagged effect when plotted. Try something like this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest=-24h@h sourcetype=access*| timechart  span=10m sum(bytes) as bytes | streamstats avg(bytes) as av1 window=5 | streamstats avg(av1) as av2 window=3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Nov 2014 22:50:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127078#M34444</guid>
      <dc:creator>bmunson_splunk</dc:creator>
      <dc:date>2014-11-18T22:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate moving average and graph it as an overlay on a bar chart of actual values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127079#M34445</link>
      <description>&lt;P&gt;You are right, streamstats and trendline both work. I misunderstood the way the averages are calculated. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 19 Nov 2014 17:34:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127079#M34445</guid>
      <dc:creator>krwinters11</dc:creator>
      <dc:date>2014-11-19T17:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate moving average and graph it as an overlay on a bar chart of actual values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127080#M34446</link>
      <description>&lt;P&gt;If you convert it to an answer, I'll accept it.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Nov 2014 17:37:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127080#M34446</guid>
      <dc:creator>krwinters11</dc:creator>
      <dc:date>2014-11-19T17:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate moving average and graph it as an overlay on a bar chart of actual values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127081#M34447</link>
      <description>&lt;P&gt;@bmunson_splunk I tried this and eventually got it to work. But can you clarify what &lt;CODE&gt;as av1 window=5&lt;/CODE&gt; will that be the average of tje  1st 10min slot to the 5th 10min slot, and this average is put in the 5th slot, and not put in the 6th slot.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Slots10min  totalPerslot    av1     
slot1   10  10  &amp;lt;&amp;lt;-average of slot1 
slot2   11  10.5    &amp;lt;&amp;lt;-average of slot1-slot2   
slot3   12  11  &amp;lt;&amp;lt;-average of slot1-slot3   
slot4   13  11.5    &amp;lt;&amp;lt;-average of slot1-slot4   
slot5   14  12  &amp;lt;&amp;lt;-average of slot1-slot5   
slot6   15  13      
slot7   16  14      
slot8   17  15      
slot9   18  16      
slot10  19  17  
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Apr 2015 23:14:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127081#M34447</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2015-04-27T23:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate moving average and graph it as an overlay on a bar chart of actual values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127082#M34448</link>
      <description>&lt;P&gt;The &lt;CODE&gt;as av1&lt;/CODE&gt; just tells splunk to name the average av1.&lt;BR /&gt;&lt;BR /&gt;
&lt;CODE&gt;window=5&lt;/CODE&gt; says take the average over 5 events (by default) including this one. So the average of slot 1-5 goes in slot 5 , 2-6 in slot 6 and so on. But there is an extra option you can say, &lt;CODE&gt;current=false&lt;/CODE&gt;. This will then over ride the default and use the previous 5 not including the current one. So slot6 has the average of 1-5, slot7 has 2-6 and so on.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Apr 2015 23:44:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-moving-average-and-graph-it-as-an-overlay-on-a/m-p/127082#M34448</guid>
      <dc:creator>BobM</dc:creator>
      <dc:date>2015-04-27T23:44:44Z</dc:date>
    </item>
  </channel>
</rss>

