<?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 create an alert that only fires when threshold is exceeded and resets once results are within that threshold? in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-do-I-create-an-alert-that-only-fires-when-threshold-is/m-p/451690#M7980</link>
    <description>&lt;P&gt;I would use a lookup table to keep the current state&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=someindex sourcetype="somesourcetype" source="somesource" Var1="StaticValue"  Var2=StaticValue | dedup VAR1 VAR2 | eval state=if(NUMERICAL_VALUE  &amp;gt; 5, 1, 0) | lookup alertstate.csv host OUTPUT state AS previous_state | outputlookup override_if_empty=false alertstate.csv | where previous_state&amp;lt;state
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 31 Oct 2018 12:27:23 GMT</pubDate>
    <dc:creator>baldwintm</dc:creator>
    <dc:date>2018-10-31T12:27:23Z</dc:date>
    <item>
      <title>How do I create an alert that only fires when threshold is exceeded and resets once results are within that threshold?</title>
      <link>https://community.splunk.com/t5/Alerting/How-do-I-create-an-alert-that-only-fires-when-threshold-is/m-p/451689#M7979</link>
      <description>&lt;P&gt;I have a scenario where I need to build an alert for a search that triggers on a numerical value. I need to set a threshold and alert that triggers only when that threshold is exceeded, and then have the alert reset once the value is under that threshold.&lt;/P&gt;

&lt;P&gt;So basically, var2 returns a NUMERICAL_VALUE, which is the numerical value that I need to alert on. &lt;/P&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;when NUMERICAL_VALUE goes above 5, I want the alert to fire. So, if the NUMERICAL_VALUE goes from 4 to 6, the alert would fire, but not if it goes from 6 to 7. &lt;/LI&gt;
&lt;LI&gt;If the NUMERICAL_VALUE goes from 7 back to 4, that would reset the alert. Then, if NUMERICAL_VALUE went back from 4 to 6, it would trigger the alert again. &lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;I have the alert search set to run every two minutes. &lt;/P&gt;

&lt;P&gt;Thanks if anyone has any answers.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=someindex sourcetype="somesourcetype" source="somesource" Var1="StaticValue"  Var2=StaticValue | dedup VAR1 VAR2 | where NUMERICAL_VALUE  &amp;gt; 5
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:47:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-do-I-create-an-alert-that-only-fires-when-threshold-is/m-p/451689#M7979</guid>
      <dc:creator>pwilly</dc:creator>
      <dc:date>2020-09-29T21:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create an alert that only fires when threshold is exceeded and resets once results are within that threshold?</title>
      <link>https://community.splunk.com/t5/Alerting/How-do-I-create-an-alert-that-only-fires-when-threshold-is/m-p/451690#M7980</link>
      <description>&lt;P&gt;I would use a lookup table to keep the current state&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=someindex sourcetype="somesourcetype" source="somesource" Var1="StaticValue"  Var2=StaticValue | dedup VAR1 VAR2 | eval state=if(NUMERICAL_VALUE  &amp;gt; 5, 1, 0) | lookup alertstate.csv host OUTPUT state AS previous_state | outputlookup override_if_empty=false alertstate.csv | where previous_state&amp;lt;state
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Oct 2018 12:27:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-do-I-create-an-alert-that-only-fires-when-threshold-is/m-p/451690#M7980</guid>
      <dc:creator>baldwintm</dc:creator>
      <dc:date>2018-10-31T12:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create an alert that only fires when threshold is exceeded and resets once results are within that threshold?</title>
      <link>https://community.splunk.com/t5/Alerting/How-do-I-create-an-alert-that-only-fires-when-threshold-is/m-p/451691#M7981</link>
      <description>&lt;P&gt;Keep track of your alert state in a lookup table; you need 2 searches like these:&lt;/P&gt;

&lt;P&gt;Set Alert (fire once):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=someindex sourcetype="somesourcetype" source="somesource" VAR1="StaticValue"  VAR2="StaticValue"
| dedup VAR1 VAR2
| where NUMERICAL_VALUE  &amp;gt; 5
| table VAR1 VAR2 NUMERICAL_VALUE
| lookup YourLookupFileNameHere.csv VAR1 VAR2 OUTPUT fired_time
| where isnull(fired_time)
| eval fired_time=now()
| outputlookup  coverride_if_empty=false YourLookupFileNameHere.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then create another scheduled search to clear out the lookup file when NUMERICAL_VALUE &amp;lt; 5.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2018 19:04:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-do-I-create-an-alert-that-only-fires-when-threshold-is/m-p/451691#M7981</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-10-31T19:04:58Z</dc:date>
    </item>
  </channel>
</rss>

