<?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 do I get cumulative moving average? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-cumulative-moving-average/m-p/419365#M120586</link>
    <description>&lt;P&gt;I chose the &lt;CODE&gt;time_window&lt;/CODE&gt; option based on your use of &lt;CODE&gt;timechart span=5h&lt;/CODE&gt;, but you can use another option that works better for your use case.&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jul 2019 18:21:33 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2019-07-31T18:21:33Z</dc:date>
    <item>
      <title>How do I get cumulative moving average?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-cumulative-moving-average/m-p/419362#M120583</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;

&lt;P&gt;I am trying to compute and chart the cumulative moving average (ref. of what is it:&lt;A href="https://en.wikipedia.org/wiki/Moving_average#Cumulative_moving_average"&gt;https://en.wikipedia.org/wiki/Moving_average#Cumulative_moving_average&lt;/A&gt;)&lt;/P&gt;

&lt;P&gt;The point is that I am doing the following query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=SARITA source="login.csv" | reverse | accum elapsed_time as cumulative_elapsed_time | timechart span=5h last(cumulative_elapsed_time) by server
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And what I get from it is the cumulative sum. Now what I still need is to get cumulative count (which means, for any "n" value, to get the amount n up to that point in time, but not the total amount of values of all that series), so I can divide the cumulative value by the cumulative count, thus having the cumulative average.&lt;/P&gt;

&lt;P&gt;Please help me with this, as I am really stuck on it. Thank you very much in advance for your patience.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
Brian&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 14:36:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-cumulative-moving-average/m-p/419362#M120583</guid>
      <dc:creator>brdennehy</dc:creator>
      <dc:date>2019-07-31T14:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get cumulative moving average?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-cumulative-moving-average/m-p/419363#M120584</link>
      <description>&lt;P&gt;Use the &lt;CODE&gt;streamstats&lt;/CODE&gt; command to count the events.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=SARITA source="login.csv" 
| reverse 
| streamstats count 
| accum elapsed_time as cumulative_elapsed_time 
| timechart span=5h last(cumulative_elapsed_time) by server
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Even better would be to let &lt;CODE&gt;streamstats&lt;/CODE&gt; do the moving average for you.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=SARITA source="login.csv" 
| reverse 
| streamstats time_window=5h avg(elapsed_time) as AvgElapsedTime by server
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Jul 2019 15:15:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-cumulative-moving-average/m-p/419363#M120584</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-07-31T15:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get cumulative moving average?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-cumulative-moving-average/m-p/419364#M120585</link>
      <description>&lt;P&gt;Thanks!! I'll try the streamstats tomorrow.&lt;/P&gt;

&lt;P&gt;The problem with your suggestion of making streamstats to do the moving average for me is that the time window must be from the first measure until that point n in question, and not 5h....&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 15:26:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-cumulative-moving-average/m-p/419364#M120585</guid>
      <dc:creator>brdennehy</dc:creator>
      <dc:date>2019-07-31T15:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get cumulative moving average?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-cumulative-moving-average/m-p/419365#M120586</link>
      <description>&lt;P&gt;I chose the &lt;CODE&gt;time_window&lt;/CODE&gt; option based on your use of &lt;CODE&gt;timechart span=5h&lt;/CODE&gt;, but you can use another option that works better for your use case.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 18:21:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-cumulative-moving-average/m-p/419365#M120586</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-07-31T18:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get cumulative moving average?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-cumulative-moving-average/m-p/419366#M120587</link>
      <description>&lt;P&gt;Thanks man! I used the default (non specified) time-frame. I read that the limit is 10,000 events, but it's ok. I only have 2 events per day.&lt;/P&gt;

&lt;P&gt;Thank you very much!!!&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2019 07:47:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-cumulative-moving-average/m-p/419366#M120587</guid>
      <dc:creator>brdennehy</dc:creator>
      <dc:date>2019-08-01T07:47:25Z</dc:date>
    </item>
  </channel>
</rss>

