<?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 would I compare the average daily results from the previous time period to today? in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-would-I-compare-the-average-daily-results-from-the-previous/m-p/156303#M2565</link>
    <description>&lt;P&gt;Another option&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|multisearch [search index="reseller" sourcetype="oneclick_error_log" Sitename="*" earliest=-8d@d latest=@d | eval type="weeklyAvg" ][search index="reseller" sourcetype="oneclick_error_log" Sitename="*"  earliest=@d | eval type="today" ] |bucket span=1d _time| chart count  over loggingAppId by type | eval weeklyAvg=round(weeklyAvg/7,2) | eval change_percent=round((today-weeklyAvg)*100/weeklyAvg,2) | where  change_percent&amp;gt; 25
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 09 May 2014 14:40:25 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2014-05-09T14:40:25Z</dc:date>
    <item>
      <title>How would I compare the average daily results from the previous time period to today?</title>
      <link>https://community.splunk.com/t5/Alerting/How-would-I-compare-the-average-daily-results-from-the-previous/m-p/156298#M2560</link>
      <description>&lt;P&gt;I'm trying to create some monitoring alerts for when errors increase greater than a certain amount compared to their usual amount. I've got it working to compare yesterday to today, but I'd like to compare the daily average of a certain period to today for more accurate results. This is proving to be a little too tricky for me and any help would be greatly appreciated! Here is my current search:&lt;/P&gt;

&lt;PRE&gt;index="reseller" sourcetype="oneclick_error_log" Sitename="*" | bucket _time span="d" | stats count AS oneclick_errors by Sitename, _time | delta oneclick_errors as change | eval change_percent=change/(oneclick_errors-change)*100 | sort Sitename | where _time&amp;gt;=relative_time(now(),"-d") AND change_percent &amp;gt; 25&lt;/PRE&gt;

&lt;P&gt;Note: I have the alert set to run at midnight so there is a complete dataset for comparison.&lt;/P&gt;</description>
      <pubDate>Wed, 07 May 2014 22:11:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-would-I-compare-the-average-daily-results-from-the-previous/m-p/156298#M2560</guid>
      <dc:creator>daviduslan</dc:creator>
      <dc:date>2014-05-07T22:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: How would I compare the average daily results from the previous time period to today?</title>
      <link>https://community.splunk.com/t5/Alerting/How-would-I-compare-the-average-daily-results-from-the-previous/m-p/156299#M2561</link>
      <description>&lt;P&gt;One way, but perhaps not the best, is by using a subsearch and &lt;CODE&gt;eval&lt;/CODE&gt;.  Here's an example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest=@d sourcetype=access_combined 
| eval 
    [ search earliest=-1d@d latest=@d sourcetype=access_combined 
        | stats avg(bytes) as avg_bytes 
        | return avg_bytes 
    ] 
| table _time, avg_bytes, bytes
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this example, the &lt;CODE&gt;eval&lt;/CODE&gt; command looks a little strange.  But, remember, subsearches are a textual construct.  So, by the time the subsearch finishes, the search command inside of &lt;CODE&gt;[&lt;/CODE&gt; and &lt;CODE&gt;]&lt;/CODE&gt; will be textually replaced by the results of the subsearch - in this case &lt;CODE&gt;avg_bytes=&amp;lt;some_number&amp;gt;&lt;/CODE&gt;.  This happens before the &lt;CODE&gt;eval&lt;/CODE&gt; even "sees it" - all &lt;CODE&gt;eval&lt;/CODE&gt; "sees" is &lt;CODE&gt;| eval avg_bytes=1234567&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;This is probably not the best performing way of solving this problem and could be improved a by a summary index or an acceleration of the subsearch.  &lt;/P&gt;</description>
      <pubDate>Thu, 08 May 2014 01:22:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-would-I-compare-the-average-daily-results-from-the-previous/m-p/156299#M2561</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2014-05-08T01:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: How would I compare the average daily results from the previous time period to today?</title>
      <link>https://community.splunk.com/t5/Alerting/How-would-I-compare-the-average-daily-results-from-the-previous/m-p/156300#M2562</link>
      <description>&lt;P&gt;Turns out I'm working with way too much data for subsearches. I came up with  a different solution that I'll post in a separate comment.&lt;/P&gt;</description>
      <pubDate>Fri, 09 May 2014 00:01:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-would-I-compare-the-average-daily-results-from-the-previous/m-p/156300#M2562</guid>
      <dc:creator>daviduslan</dc:creator>
      <dc:date>2014-05-09T00:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: How would I compare the average daily results from the previous time period to today?</title>
      <link>https://community.splunk.com/t5/Alerting/How-would-I-compare-the-average-daily-results-from-the-previous/m-p/156301#M2563</link>
      <description>&lt;P&gt;This is the search I ended up using to solve my problem (there was too much data to use a subsearch/eval). The change_percent still needs some work, but I've got my data how I want it.&lt;/P&gt;

&lt;PRE&gt;index="reseller" sourcetype="oneclick_error_log" Sitename="*" earliest=-8d
| stats count as weekly_total_errors, count(eval(if( _time&amp;gt;relative_time(now(),"-d"),"x",NULL))) as todays_errors by Sitename
| eval weekly_total_errors = weekly_total_errors - todays_errors
| eval weekly_avg = weekly_total_errors/7
| eval change = todays_errors-weekly_avg
| eval change_percent = (change/weekly_avg)*100&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 May 2014 00:03:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-would-I-compare-the-average-daily-results-from-the-previous/m-p/156301#M2563</guid>
      <dc:creator>daviduslan</dc:creator>
      <dc:date>2014-05-09T00:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: How would I compare the average daily results from the previous time period to today?</title>
      <link>https://community.splunk.com/t5/Alerting/How-would-I-compare-the-average-daily-results-from-the-previous/m-p/156302#M2564</link>
      <description>&lt;P&gt;There is also an app that allows you to do this easily.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://apps.splunk.com/app/1645"&gt;http://apps.splunk.com/app/1645&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 May 2014 01:53:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-would-I-compare-the-average-daily-results-from-the-previous/m-p/156302#M2564</guid>
      <dc:creator>Lucas_K</dc:creator>
      <dc:date>2014-05-09T01:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: How would I compare the average daily results from the previous time period to today?</title>
      <link>https://community.splunk.com/t5/Alerting/How-would-I-compare-the-average-daily-results-from-the-previous/m-p/156303#M2565</link>
      <description>&lt;P&gt;Another option&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|multisearch [search index="reseller" sourcetype="oneclick_error_log" Sitename="*" earliest=-8d@d latest=@d | eval type="weeklyAvg" ][search index="reseller" sourcetype="oneclick_error_log" Sitename="*"  earliest=@d | eval type="today" ] |bucket span=1d _time| chart count  over loggingAppId by type | eval weeklyAvg=round(weeklyAvg/7,2) | eval change_percent=round((today-weeklyAvg)*100/weeklyAvg,2) | where  change_percent&amp;gt; 25
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 May 2014 14:40:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-would-I-compare-the-average-daily-results-from-the-previous/m-p/156303#M2565</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-05-09T14:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: How would I compare the average daily results from the previous time period to today?</title>
      <link>https://community.splunk.com/t5/Alerting/How-would-I-compare-the-average-daily-results-from-the-previous/m-p/156304#M2566</link>
      <description>&lt;P&gt;Unfortunately the limit on data subsearches can process makes this a solution I can't use. Thanks so much for the response though!&lt;/P&gt;</description>
      <pubDate>Fri, 09 May 2014 16:22:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-would-I-compare-the-average-daily-results-from-the-previous/m-p/156304#M2566</guid>
      <dc:creator>daviduslan</dc:creator>
      <dc:date>2014-05-09T16:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: How would I compare the average daily results from the previous time period to today?</title>
      <link>https://community.splunk.com/t5/Alerting/How-would-I-compare-the-average-daily-results-from-the-previous/m-p/156305#M2567</link>
      <description>&lt;P&gt;I've played with timewrap - it's super awesome and powerful, but I couldn't figure how to configure it to compare larger windows of time to smaller windows (last week vs today). If I wanted to compare the results today to the same day last week, it would be perfect.&lt;/P&gt;</description>
      <pubDate>Fri, 09 May 2014 16:39:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-would-I-compare-the-average-daily-results-from-the-previous/m-p/156305#M2567</guid>
      <dc:creator>daviduslan</dc:creator>
      <dc:date>2014-05-09T16:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: How would I compare the average daily results from the previous time period to today?</title>
      <link>https://community.splunk.com/t5/Alerting/How-would-I-compare-the-average-daily-results-from-the-previous/m-p/156306#M2568</link>
      <description>&lt;P&gt;How do you refine the WHERE clause so that it not only looks for "change_percent &amp;gt; 25" but also "weeklyAvg &amp;gt; 100" for example?   I've tried "where change_percent &amp;gt; 25 and weeklyAvg &amp;gt; 100" in my example but what happens is that during the first parsing phase, I see the results of the query (before the WHERE statement) being populated in the table from the stats command.  But as soon as it gets to the WHERE statement, the long list of entries gets reduced to just a few (where a lot more is clearly expected).&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:12:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-would-I-compare-the-average-daily-results-from-the-previous/m-p/156306#M2568</guid>
      <dc:creator>fshimaya</dc:creator>
      <dc:date>2020-09-29T16:12:00Z</dc:date>
    </item>
  </channel>
</rss>

