<?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 How do I create an alert that will search for two separate string values with the OR condition inside the search? in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-do-I-create-an-alert-that-will-search-for-two-separate/m-p/628281#M14677</link>
    <description>&lt;P&gt;I'm creating an alert that will search for two separate string values with the OR condition inside the search. Is there a way to setup the alert condition to fire for 'If the second event is not found within 5 minutes of the first event, fire the alert.'?&amp;nbsp; The events happen anytime within a 6 hour window, so having it search every 5 minutes for a count under 2 would fire alerts constantly.&lt;/P&gt;</description>
    <pubDate>Wed, 25 Jan 2023 23:58:32 GMT</pubDate>
    <dc:creator>Curiuu</dc:creator>
    <dc:date>2023-01-25T23:58:32Z</dc:date>
    <item>
      <title>How do I create an alert that will search for two separate string values with the OR condition inside the search?</title>
      <link>https://community.splunk.com/t5/Alerting/How-do-I-create-an-alert-that-will-search-for-two-separate/m-p/628281#M14677</link>
      <description>&lt;P&gt;I'm creating an alert that will search for two separate string values with the OR condition inside the search. Is there a way to setup the alert condition to fire for 'If the second event is not found within 5 minutes of the first event, fire the alert.'?&amp;nbsp; The events happen anytime within a 6 hour window, so having it search every 5 minutes for a count under 2 would fire alerts constantly.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2023 23:58:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-do-I-create-an-alert-that-will-search-for-two-separate/m-p/628281#M14677</guid>
      <dc:creator>Curiuu</dc:creator>
      <dc:date>2023-01-25T23:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Alert</title>
      <link>https://community.splunk.com/t5/Alerting/How-do-I-create-an-alert-that-will-search-for-two-separate/m-p/628291#M14678</link>
      <description>&lt;P&gt;Try this running over the previous 10 minutes (or longer).&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;search string1 or string2&amp;gt;
``` Ensure events in chronological order ```
| sort 0 _time
``` Get timeframe of search ```
| addinfo
``` Capture time of event if string 1 present (however you determine that) ```
| eval string1_time=if(&amp;lt;string1 in event&amp;gt;, _time, null())
``` Capture time of event if string 2 present (however you determine that) and after the first 5 minutes ```
| eval string2_time=if(&amp;lt;string2 in event&amp;gt; AND _time &amp;gt;= info_min_time + 300, _time, null())
``` Track latest times of string 1 through the event stream ```
| streamstats max(string1_time) as last_string1_time
``` Mark string 2 events as not OK if no previous string 1 or if previous string 1 too far in the past ```
| eval NOK=if(isnotnull(string2_time), if(isnotnull(last_string1_time) AND string2_time - last_string1_time &amp;lt;= 300, 0, 1), null())
``` Remove timing for string 1 events if in last 5 minutes ```
| eval string1_time=if(isnotnull(string1_time) AND string1_time &amp;lt;= info_max_time - 300, string1_time, null())
``` Count bad string 2 events and get last string 1 time prior to last 5 minutes ```
| stats sum(NOK) as NOK max(string1_time) as last_string1_time
``` Alert condition (number of results &amp;gt; 0) if any bad string 2 events or no string 2 events but there were string 1 events prior to last 5 minutes ```
| where NOK &amp;gt; 0 OR (isnull(NOK) AND isnotnull(last_string1_time))&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 25 Jan 2023 15:40:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-do-I-create-an-alert-that-will-search-for-two-separate/m-p/628291#M14678</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-01-25T15:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Alert</title>
      <link>https://community.splunk.com/t5/Alerting/How-do-I-create-an-alert-that-will-search-for-two-separate/m-p/628648#M14680</link>
      <description>&lt;P&gt;Got this to work, thank you so much!&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2023 16:49:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-do-I-create-an-alert-that-will-search-for-two-separate/m-p/628648#M14680</guid>
      <dc:creator>Curiuu</dc:creator>
      <dc:date>2023-01-27T16:49:19Z</dc:date>
    </item>
  </channel>
</rss>

