<?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 show a numeric average of last X days with real time value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-a-numeric-average-of-last-X-days-with-real-time/m-p/94134#M24248</link>
    <description>&lt;P&gt;I am not sure this is right way, but Icame up with the following:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;Create summary index for 7 day average&lt;/P&gt;

&lt;P&gt;index=test earliest=-7d@d latest=@d | stats avg(number) as mean | addinfo | collect index=summary addinfo marker="info_search_name=\"7day_avg_num\""&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Search from summary index and put the average value using eval + subsearch&lt;/P&gt;

&lt;P&gt;index=test | eval 7day_avg=([search index=summary info_search_name="7day_avg_num" | head 1 | rename mean as search]) | timechart avg(7day_avg), avg(number)&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Any comment appreciated.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 11:34:02 GMT</pubDate>
    <dc:creator>melonman</dc:creator>
    <dc:date>2020-09-28T11:34:02Z</dc:date>
    <item>
      <title>How do I show a numeric average of last X days with real time value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-a-numeric-average-of-last-X-days-with-real-time/m-p/94133#M24247</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I am trying to create a timechart report that displays both average of a numeric value of last 7 days and real time value in 30sec realtime window. &lt;/P&gt;

&lt;P&gt;The data looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2012/03/16 15:29:44 number=2090 uname=uid19 loc=area1_section8 ipaddr=10.1.1.31 result=success
2012/03/16 15:29:44 number=4816 uname=uid44 loc=area0_section4 ipaddr=10.1.1.19 result=success
2012/03/16 15:29:44 number=7542 uname=uid5 loc=area0_section9 ipaddr=10.1.1.7 result=success
2012/03/16 15:29:44 number=269 uname=uid30 loc=area2_section5 ipaddr=10.1.1.32 result=failed
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I came up with the following search and set the time range to 30 sec window.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=test sourcetype=sample2 | eventstats mean(number) as mean | timechart avg(mean) max(number)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, the average, mean value changes as events get indexed because the eventstats calculates only mean in recent 30 sec window. &lt;/P&gt;

&lt;P&gt;Is there search that calculate last 7 days mean and use the mean as fixed value while realtime search is running so the mean value does not get calculated in realtime with recent 30 sec realtime value?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2012 06:31:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-a-numeric-average-of-last-X-days-with-real-time/m-p/94133#M24247</guid>
      <dc:creator>melonman</dc:creator>
      <dc:date>2012-03-16T06:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do I show a numeric average of last X days with real time value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-a-numeric-average-of-last-X-days-with-real-time/m-p/94134#M24248</link>
      <description>&lt;P&gt;I am not sure this is right way, but Icame up with the following:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;Create summary index for 7 day average&lt;/P&gt;

&lt;P&gt;index=test earliest=-7d@d latest=@d | stats avg(number) as mean | addinfo | collect index=summary addinfo marker="info_search_name=\"7day_avg_num\""&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Search from summary index and put the average value using eval + subsearch&lt;/P&gt;

&lt;P&gt;index=test | eval 7day_avg=([search index=summary info_search_name="7day_avg_num" | head 1 | rename mean as search]) | timechart avg(7day_avg), avg(number)&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Any comment appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:34:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-show-a-numeric-average-of-last-X-days-with-real-time/m-p/94134#M24248</guid>
      <dc:creator>melonman</dc:creator>
      <dc:date>2020-09-28T11:34:02Z</dc:date>
    </item>
  </channel>
</rss>

