<?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 compare current data with data from 24 hours ago, calculate the percentage change and alert if the change exceeds a threshold? in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-to-compare-current-data-with-data-from-24-hours-ago/m-p/114419#M1688</link>
    <description>&lt;P&gt;I agree with that....&lt;/P&gt;</description>
    <pubDate>Fri, 10 Apr 2015 19:02:26 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2015-04-10T19:02:26Z</dc:date>
    <item>
      <title>How to compare current data with data from 24 hours ago, calculate the percentage change and alert if the change exceeds a threshold?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-compare-current-data-with-data-from-24-hours-ago/m-p/114414#M1683</link>
      <description>&lt;P&gt;I want to create a splunk alert in such a way that it compares current data with yesterdays during the same time period. For e.g today at 1:00 PM will compare with yesterday 1:00 PM. &lt;BR /&gt;
then I want to calculate the change percent  of those two results. On basis of what we get want set the alert if change percent exceeds certain threshold (say X). &lt;/P&gt;

&lt;P&gt;e.g. todays error count at x hour is 500, yesterday's error count at x hour was 300. change percent = 500-300=200X.01=2%&lt;BR /&gt;
if threshold is set to 1%, alert is triggered.&lt;/P&gt;

&lt;P&gt;Any help would be appreciated. &lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jan 2015 01:03:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-compare-current-data-with-data-from-24-hours-ago/m-p/114414#M1683</guid>
      <dc:creator>abajracharya</dc:creator>
      <dc:date>2015-01-29T01:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare current data with data from 24 hours ago, calculate the percentage change and alert if the change exceeds a threshold?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-compare-current-data-with-data-from-24-hours-ago/m-p/114415#M1684</link>
      <description>&lt;P&gt;This should do it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere -earliest=-25h@h -latest=@h
| eval WhichDay = case(_time&amp;gt;=relative_time(now(),"-1h@h"),"Today",
                       _time&amp;lt;=relative_time(now(),"-24h@h"),"Yesterday",
                       1==1,null())
| stats count(eval(WhichDay=="Today")) as Today count(eval(WhichDay=="Yesterday")) as Yesterday 
| eval ChangePercent = (Today - Yesterday) / 100
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is an example of how the times work:&lt;/P&gt;

&lt;P&gt;The search starts at 2:07 - this is the value of now()&lt;BR /&gt;&lt;BR /&gt;
@h = 2:00 - the end of today's hour&lt;BR /&gt;&lt;BR /&gt;
-1h@h = 1:00 - the beginning of today's hour&lt;BR /&gt;&lt;BR /&gt;
-24h@h = yesterday at 2:00 - the end of yesterday's hour&lt;BR /&gt;&lt;BR /&gt;
-25h@h = yesterday at 1:00 - the beginning of yesterday's hour&lt;BR /&gt;&lt;BR /&gt;
_time = the timestamp of the event&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jan 2015 02:07:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-compare-current-data-with-data-from-24-hours-ago/m-p/114415#M1684</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-01-29T02:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare current data with data from 24 hours ago, calculate the percentage change and alert if the change exceeds a threshold?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-compare-current-data-with-data-from-24-hours-ago/m-p/114416#M1685</link>
      <description>&lt;P&gt;Thank you for the response. &lt;/P&gt;

&lt;P&gt;When i ran this query it just showed me data for today but nothing for yesterday. &lt;/P&gt;

&lt;P&gt;thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jan 2015 23:50:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-compare-current-data-with-data-from-24-hours-ago/m-p/114416#M1685</guid>
      <dc:creator>abajracharya</dc:creator>
      <dc:date>2015-01-29T23:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare current data with data from 24 hours ago, calculate the percentage change and alert if the change exceeds a threshold?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-compare-current-data-with-data-from-24-hours-ago/m-p/114417#M1686</link>
      <description>&lt;P&gt;I just corrected a typo... sorry.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Feb 2015 06:44:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-compare-current-data-with-data-from-24-hours-ago/m-p/114417#M1686</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-02-06T06:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare current data with data from 24 hours ago, calculate the percentage change and alert if the change exceeds a threshold?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-compare-current-data-with-data-from-24-hours-ago/m-p/114418#M1687</link>
      <description>&lt;P&gt;Couldn't this be more efficient with appendcols? I have a hard time believing the inefficiency of a sub-search will eclipse the inefficiency of returning 25 hours worth of records and only using 2 of them, especially if we're talking about a dataset with millions of events.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;some search earliest=-1h@h latest=@h | 
stats count as Today | 
appendcols [search some search earliest=-25h@h latest=-24h@h | 
stats count as Yesterday ] | 
eval ChangePercent = (Today - Yesterday) / 100
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Mar 2015 16:58:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-compare-current-data-with-data-from-24-hours-ago/m-p/114418#M1687</guid>
      <dc:creator>twinspop</dc:creator>
      <dc:date>2015-03-09T16:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare current data with data from 24 hours ago, calculate the percentage change and alert if the change exceeds a threshold?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-compare-current-data-with-data-from-24-hours-ago/m-p/114419#M1688</link>
      <description>&lt;P&gt;I agree with that....&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2015 19:02:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-compare-current-data-with-data-from-24-hours-ago/m-p/114419#M1688</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-04-10T19:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare current data with data from 24 hours ago, calculate the percentage change and alert if the change exceeds a threshold?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-compare-current-data-with-data-from-24-hours-ago/m-p/114420#M1689</link>
      <description>&lt;P&gt;Hi @twinspop , @lguinn2 ,&lt;/P&gt;

&lt;P&gt;What I want is : "If the current pendingMsg count is greater than or equal to the last one hour count, then display the queueName with label - 'Queue with no processing since last one hour' "&lt;BR /&gt;
(OR we can say the outTotalMsgs is same for now and last one hour event)&lt;/P&gt;

&lt;P&gt;Example : &lt;BR /&gt;
My basic search &lt;A href="https://community.splunk.com/will%20have%20lot%20of%20different%20queues,%20and%20I%20want%20the%20above%20statement%20for%20all%20of%20them"&gt;no dedup applied&lt;/A&gt;, but currently I have written only one queueName :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ..... | xmlkv | table _time, qName, pendingMsgCount, inTotalMsgs, outTotalMsgs
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Timestamp (last 60 minutes) - (22/02/2019 06:58:00.000 to 22/02/2019 07:58:13.000)&lt;/P&gt;

&lt;P&gt;Results : only one queueName (124 events)&lt;/P&gt;

&lt;P&gt;first two :&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/199i396E41826E2A5030/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;last two :&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/200i4F4971395C5ECA80/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;So, for this queueName, the pendingMsg count OR outMessges Count is same and hence it should be displayed in results for dashboard - 'Queue with no processing since last one hour'.&lt;/P&gt;

&lt;P&gt;I am not able to achieve this, please help!&lt;/P&gt;

&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 11:26:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-compare-current-data-with-data-from-24-hours-ago/m-p/114420#M1689</guid>
      <dc:creator>vaibhavvijay9</dc:creator>
      <dc:date>2019-02-22T11:26:46Z</dc:date>
    </item>
  </channel>
</rss>

