<?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 Set an Alert to Fire on The Total Count? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-Set-an-Alert-to-Fire-on-The-Total-Count/m-p/211204#M61754</link>
    <description>&lt;P&gt;saved search:&lt;BR /&gt;
index=vertex7-access RTG_Error="500" earliest=-1h@h latest=@h &lt;BR /&gt;
| stats count AS TodayLastHour &lt;BR /&gt;
| append [search index=vertex7-access RTG_Error="500" earliest=-25h@h latest=-24h@h | stats count AS YesterdayLastHour] &lt;BR /&gt;
| where TodayLastHour &amp;gt; 1.25 * YesterdayLastHour&lt;/P&gt;

&lt;P&gt;trigger:&lt;BR /&gt;
if results &amp;gt; 0&lt;/P&gt;

&lt;P&gt;run a script: perlscript.that.calls.splunkd.and.triggers.report.email.search&lt;/P&gt;

&lt;P&gt;saved report / email search:&lt;BR /&gt;
index=vertex7-access RTG_Error="500" earliest=-1h@h latest=@h | stats count AS TodayLastHour by RTG_Tax | addtotals col=t | table RTG_Tax, TodayLastHour | appendcols [search index=vertex7-access RTG_Error="500" earliest=-25h@h latest=-24h@h | stats count AS YesterdayLastHour by RTG_Tax | addtotals col=t | table RTG_Tax, TodayLastHour, YesterdayLastHour] | where TodayLastHour &amp;gt; 1.25 * YesterdayLastHour&lt;/P&gt;

&lt;P&gt;trigger: always alert&lt;/P&gt;

&lt;P&gt;So that the first one triggers a script that runs a saved search which triggers an email. The first one will only run when the where clause is met, and the 2nd search is ran by a perl script via splunkd api call.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 07:12:57 GMT</pubDate>
    <dc:creator>jkat54</dc:creator>
    <dc:date>2020-09-29T07:12:57Z</dc:date>
    <item>
      <title>How to Set an Alert to Fire on The Total Count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Set-an-Alert-to-Fire-on-The-Total-Count/m-p/211199#M61749</link>
      <description>&lt;P&gt;I have an alert set which will compare the errors for the current day's previous hour to yesterday's previous hour.. &lt;/P&gt;

&lt;P&gt;So it will run a search every hour and count the number of errors from 1pm-2pm today and compare them to the number of errors received yesterday from 1pm-2pm. If the number of errors for today's hour is 25% higher than yesterday's hour of errors, then the alert will fire. &lt;/P&gt;

&lt;P&gt;I set the search up and it's working as expected, but I believe I misconfigured the alert because I just got 2 alert emails. The first email is showing Calculate Tax errors, then the next alert email is showing the total number of errors. I want the alert to fire if ONLY if the total value for 'TodayLastHour' is 25% greater than 'YesterdayLastHour'. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Tax Call          |   TodayLastHour             | YesterdayLastHour
CalculateTax      |        290                  |      100
LookupTax         |        100                  |       90
TOTAL             |        390                  |      190
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here's my search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=vertex7-access RTG_Error="500" earliest=-1h@h latest=@h | stats count AS TodayLastHour by RTG_Tax | addtotals col=t | table RTG_Tax, TodayLastHour | appendcols [search index=vertex7-access RTG_Error="500" earliest=-25h@h latest=-24h@h | stats count AS YesterdayLastHour by RTG_Tax | addtotals col=t | table RTG_Tax, TodayLastHour, YesterdayLastHour] | where TodayLastHour &amp;gt;  1.25 * YesterdayLastHour
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Sep 2015 18:54:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Set-an-Alert-to-Fire-on-The-Total-Count/m-p/211199#M61749</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2015-09-01T18:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set an Alert to Fire on The Total Count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Set-an-Alert-to-Fire-on-The-Total-Count/m-p/211200#M61750</link>
      <description>&lt;P&gt;I would create a separate search that only reports the total error count and use that as the basis for the alert.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2015 19:30:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Set-an-Alert-to-Fire-on-The-Total-Count/m-p/211200#M61750</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-09-01T19:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set an Alert to Fire on The Total Count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Set-an-Alert-to-Fire-on-The-Total-Count/m-p/211201#M61751</link>
      <description>&lt;P&gt;I was considering this approach but I'm not sure if this method will return the expected results. I want the alert to show a table (The one I listed above) which will show how many errors in each tax call along with the total errors. But I only want the alert to fire if the total errors from 'TodayLastHour' is 25% more then 'YesterdayLastHour' &lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2015 20:10:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Set-an-Alert-to-Fire-on-The-Total-Count/m-p/211201#M61751</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2015-09-01T20:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set an Alert to Fire on The Total Count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Set-an-Alert-to-Fire-on-The-Total-Count/m-p/211202#M61752</link>
      <description>&lt;P&gt;I guess you've configured your alert as per-result hence you get two email. If you just want one 1 alert and that too based on total value, then you would either have to update this current search (you'll loose granularity of TaxCall) OR create a new search. In any case following would be the query to use.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=vertex7-access RTG_Error="500" earliest=-1h@h latest=@h | stats count AS TodayLastHour by RTG_Tax | addtotals col=t | table RTG_Tax, TodayLastHour | appendcols [search index=vertex7-access RTG_Error="500" earliest=-25h@h latest=-24h@h | stats count AS YesterdayLastHour by RTG_Tax | addtotals col=t | table RTG_Tax, TodayLastHour, YesterdayLastHour] | table TodayLastHour YesterdayLastHour  | stats sum(*) as *  | where TodayLastHour &amp;gt;  1.25 * YesterdayLastHour
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Sep 2015 21:01:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Set-an-Alert-to-Fire-on-The-Total-Count/m-p/211202#M61752</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-09-01T21:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set an Alert to Fire on The Total Count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Set-an-Alert-to-Fire-on-The-Total-Count/m-p/211203#M61753</link>
      <description>&lt;P&gt;I think &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt; is correct:&lt;/P&gt;

&lt;P&gt;saved search:&lt;BR /&gt;
index=vertex7-access RTG_Error="500" earliest=-1h@h latest=@h &lt;BR /&gt;
| stats count AS TodayLastHour &lt;BR /&gt;
| append [search index=vertex7-access RTG_Error="500" earliest=-25h@h latest=-24h@h | stats count AS YesterdayLastHour] &lt;BR /&gt;
| where TodayLastHour &amp;gt;  1.25 * YesterdayLastHour&lt;/P&gt;

&lt;P&gt;trigger:&lt;BR /&gt;
if results &amp;gt; 0&lt;/P&gt;

&lt;P&gt;run a script: perlscript.that.calls.splunkd.and.triggers.report.email.search.pl&lt;/P&gt;

&lt;P&gt;saved report / email search:&lt;BR /&gt;
index=vertex7-access RTG_Error="500" earliest=-1h@h latest=@h | stats count AS TodayLastHour by RTG_Tax | addtotals col=t | table RTG_Tax, TodayLastHour | appendcols [search index=vertex7-access RTG_Error="500" earliest=-25h@h latest=-24h@h | stats count AS YesterdayLastHour by RTG_Tax | addtotals col=t | table RTG_Tax, TodayLastHour, YesterdayLastHour] | where TodayLastHour &amp;gt;  1.25 * YesterdayLastHour&lt;/P&gt;

&lt;P&gt;trigger: always alert&lt;/P&gt;

&lt;P&gt;So that the first one triggers a script that runs a saved search which triggers an email.  The first one will only run when the where clause is met, and the 2nd search is ran by a perl script via splunkd api call.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:12:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Set-an-Alert-to-Fire-on-The-Total-Count/m-p/211203#M61753</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-09-29T07:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set an Alert to Fire on The Total Count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Set-an-Alert-to-Fire-on-The-Total-Count/m-p/211204#M61754</link>
      <description>&lt;P&gt;saved search:&lt;BR /&gt;
index=vertex7-access RTG_Error="500" earliest=-1h@h latest=@h &lt;BR /&gt;
| stats count AS TodayLastHour &lt;BR /&gt;
| append [search index=vertex7-access RTG_Error="500" earliest=-25h@h latest=-24h@h | stats count AS YesterdayLastHour] &lt;BR /&gt;
| where TodayLastHour &amp;gt; 1.25 * YesterdayLastHour&lt;/P&gt;

&lt;P&gt;trigger:&lt;BR /&gt;
if results &amp;gt; 0&lt;/P&gt;

&lt;P&gt;run a script: perlscript.that.calls.splunkd.and.triggers.report.email.search&lt;/P&gt;

&lt;P&gt;saved report / email search:&lt;BR /&gt;
index=vertex7-access RTG_Error="500" earliest=-1h@h latest=@h | stats count AS TodayLastHour by RTG_Tax | addtotals col=t | table RTG_Tax, TodayLastHour | appendcols [search index=vertex7-access RTG_Error="500" earliest=-25h@h latest=-24h@h | stats count AS YesterdayLastHour by RTG_Tax | addtotals col=t | table RTG_Tax, TodayLastHour, YesterdayLastHour] | where TodayLastHour &amp;gt; 1.25 * YesterdayLastHour&lt;/P&gt;

&lt;P&gt;trigger: always alert&lt;/P&gt;

&lt;P&gt;So that the first one triggers a script that runs a saved search which triggers an email. The first one will only run when the where clause is met, and the 2nd search is ran by a perl script via splunkd api call.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:12:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Set-an-Alert-to-Fire-on-The-Total-Count/m-p/211204#M61754</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-09-29T07:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set an Alert to Fire on The Total Count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Set-an-Alert-to-Fire-on-The-Total-Count/m-p/211205#M61755</link>
      <description>&lt;P&gt;Go into your alert settings and change &lt;CODE&gt;When triggered, execute actions&lt;/CODE&gt; to &lt;CODE&gt;Once&lt;/CODE&gt; and it will give you your expected results.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2015 20:10:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Set-an-Alert-to-Fire-on-The-Total-Count/m-p/211205#M61755</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-09-02T20:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set an Alert to Fire on The Total Count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Set-an-Alert-to-Fire-on-The-Total-Count/m-p/211206#M61756</link>
      <description>&lt;P&gt;Worked as expected, thanks!!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2015 20:18:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Set-an-Alert-to-Fire-on-The-Total-Count/m-p/211206#M61756</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2015-09-02T20:18:03Z</dc:date>
    </item>
  </channel>
</rss>

