<?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: Creating alerts in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Creating-alerts/m-p/367477#M11096</link>
    <description>&lt;P&gt;@niketnilay - As I read it, this approach will only compare the most recent &lt;CODE&gt;service.com&lt;/CODE&gt; event with the most recent &lt;CODE&gt;connection reset error&lt;/CODE&gt;. So if the time window contains multiple events of either type (some of which would have generated an alert), but the most recent ones do not generate an alert - matches will be missed, right? To ensure you aren't missing earlier alert matches, I think you'd need a &lt;CODE&gt;streamstats&lt;/CODE&gt; approach.&lt;/P&gt;

&lt;P&gt;@Deepz2612 - Do your requirements proscribe an ordering for these two events? I notice you said that if a "service.com" alert is found, it "should search for the keyword "connection reset error" in the next few events..." Splunk returns events in reverse-chronological order by default, so looking in the "next few events" in Splunk would mean looking at the few events that occurred &lt;EM&gt;prior&lt;/EM&gt; to the &lt;CODE&gt;service.com&lt;/CODE&gt; alert. Does it matter if the &lt;CODE&gt;service.com&lt;/CODE&gt; event happens before or after the &lt;CODE&gt;connection reset error&lt;/CODE&gt; event? Also, if you are searching every, say, 15 minutes - do you want a total count of instances where &lt;CODE&gt;service.com&lt;/CODE&gt; events happened within one minute of a &lt;CODE&gt;connection reset error&lt;/CODE&gt; event, or just one alert total to indicate that at least once in that time window the two events occurred within one minute of each other?&lt;/P&gt;</description>
    <pubDate>Wed, 15 Nov 2017 15:59:42 GMT</pubDate>
    <dc:creator>elliotproebstel</dc:creator>
    <dc:date>2017-11-15T15:59:42Z</dc:date>
    <item>
      <title>Creating alerts</title>
      <link>https://community.splunk.com/t5/Alerting/Creating-alerts/m-p/367474#M11093</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
Please help me with the below.&lt;BR /&gt;
My search has to find the keyword "Service.com" and if found should search for the keyword "connection reset error" in the next few events and if found if the time difference between the events is less than or equal to 1 min to should fire an alert&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 03:20:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Creating-alerts/m-p/367474#M11093</guid>
      <dc:creator>Deepz2612</dc:creator>
      <dc:date>2017-11-13T03:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: Creating alerts</title>
      <link>https://community.splunk.com/t5/Alerting/Creating-alerts/m-p/367475#M11094</link>
      <description>&lt;P&gt;@Deepz2612, please try the following search (add your base search with index and sourcetype).&lt;/P&gt;

&lt;P&gt;Following query gets the latest events with &lt;CODE&gt;service.com&lt;/CODE&gt; and &lt;CODE&gt;connection reset error&lt;/CODE&gt;. It then calculates the duration (in minutes) between the two events.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt; "Service.com"
    |  head 1 
|  append [search &amp;lt;YourBaseSearch&amp;gt; "connection reset error"
    |  head 1]
|  stats count as eventCount earliest(_time) as startTime latest(_time) as endTime
|  eval durationInMin=case(eventCount=2,round((endTime-startTime)/60,0),true(),"NoAlert")
|  fieldformat startTime=strftime(startTime,"%Y/%m/%d %H:%M:%S %p")
|  fieldformat endTime=strftime(endTime,"%Y/%m/%d %H:%M:%S %p")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can create an alert with trigger condition as &lt;CODE&gt;durationInMin &amp;lt; 2&lt;/CODE&gt;. &lt;BR /&gt;
PS: For the time duration for which you will schedule the alert (lets say last 15 minutes), in case you get only one event (be it &lt;CODE&gt;connection reset error&lt;/CODE&gt; or &lt;CODE&gt;service.com&lt;/CODE&gt; event), it will not be an alert situation as per your description. So I have added &lt;CODE&gt;NoAlert&lt;/CODE&gt; value for durationInMin. You can change it to any positive number &amp;gt;2 so that it does not get reported as alert.&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;&lt;STRONG&gt;[Update]&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Adding description as requested:&lt;/STRONG&gt;&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt; First two search with &lt;CODE&gt;| head 1&lt;/CODE&gt; command gets latest results logged in Splunk for "Service.com" and "connection reset error"&lt;/LI&gt;
&lt;LI&gt; &lt;CODE&gt;stats&lt;/CODE&gt; is used to aggregate the two results saves earliest and latest time as epoch time to be used in next step for calculating duration.&lt;/LI&gt;
&lt;LI&gt;  If only single event is found (eventcount=1), then we need not alert. So the duration (&lt;CODE&gt;durationInMin&lt;/CODE&gt;) is calculated only if both events are present.&lt;/LI&gt;
&lt;LI&gt;  Finally fieldformat is used to convert epoch time to string time.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;While creating the alert you can set Alert trigger condition based on &lt;CODE&gt;durationInMin&lt;/CODE&gt; field.&lt;/P&gt;

&lt;P&gt;Please try out and confirm. Let us know if you need further clarifications.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 06:41:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Creating-alerts/m-p/367475#M11094</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-13T06:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: Creating alerts</title>
      <link>https://community.splunk.com/t5/Alerting/Creating-alerts/m-p/367476#M11095</link>
      <description>&lt;P&gt;Hi Nike,&lt;BR /&gt;
Thanks for the response.&lt;BR /&gt;
Could you please take some moment to explain the query.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 15:13:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Creating-alerts/m-p/367476#M11095</guid>
      <dc:creator>Deepz2612</dc:creator>
      <dc:date>2017-11-15T15:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: Creating alerts</title>
      <link>https://community.splunk.com/t5/Alerting/Creating-alerts/m-p/367477#M11096</link>
      <description>&lt;P&gt;@niketnilay - As I read it, this approach will only compare the most recent &lt;CODE&gt;service.com&lt;/CODE&gt; event with the most recent &lt;CODE&gt;connection reset error&lt;/CODE&gt;. So if the time window contains multiple events of either type (some of which would have generated an alert), but the most recent ones do not generate an alert - matches will be missed, right? To ensure you aren't missing earlier alert matches, I think you'd need a &lt;CODE&gt;streamstats&lt;/CODE&gt; approach.&lt;/P&gt;

&lt;P&gt;@Deepz2612 - Do your requirements proscribe an ordering for these two events? I notice you said that if a "service.com" alert is found, it "should search for the keyword "connection reset error" in the next few events..." Splunk returns events in reverse-chronological order by default, so looking in the "next few events" in Splunk would mean looking at the few events that occurred &lt;EM&gt;prior&lt;/EM&gt; to the &lt;CODE&gt;service.com&lt;/CODE&gt; alert. Does it matter if the &lt;CODE&gt;service.com&lt;/CODE&gt; event happens before or after the &lt;CODE&gt;connection reset error&lt;/CODE&gt; event? Also, if you are searching every, say, 15 minutes - do you want a total count of instances where &lt;CODE&gt;service.com&lt;/CODE&gt; events happened within one minute of a &lt;CODE&gt;connection reset error&lt;/CODE&gt; event, or just one alert total to indicate that at least once in that time window the two events occurred within one minute of each other?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 15:59:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Creating-alerts/m-p/367477#M11096</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2017-11-15T15:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: Creating alerts</title>
      <link>https://community.splunk.com/t5/Alerting/Creating-alerts/m-p/367478#M11097</link>
      <description>&lt;P&gt;@elliotproebstel, the Search command itself will run for a duration. For example I would be running above search every 10 minutes for last 30 minutes and once alert is triggered I can throttle for next 30 min.&lt;/P&gt;

&lt;P&gt;There could be one more possibility of changing the query so that if there is a  "connection reset error" event without Service.com, we can evaluate the same in &lt;CODE&gt;case()&lt;/CODE&gt; block and compare &lt;CODE&gt;starttime&lt;/CODE&gt; with current time i.e. &lt;CODE&gt;now()&lt;/CODE&gt; for setting &lt;CODE&gt;durationInMin&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;However, I did not want to complicate since based on the question, seemed like "connection reset error" was supposed to be correlated to "Service.com" event. In other words error will not happen until Service request is made.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 16:08:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Creating-alerts/m-p/367478#M11097</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-15T16:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating alerts</title>
      <link>https://community.splunk.com/t5/Alerting/Creating-alerts/m-p/367479#M11098</link>
      <description>&lt;P&gt;@Deepz2612, I have added the description of query.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 16:09:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Creating-alerts/m-p/367479#M11098</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-15T16:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: Creating alerts</title>
      <link>https://community.splunk.com/t5/Alerting/Creating-alerts/m-p/367480#M11099</link>
      <description>&lt;P&gt;@niketnilay Thanks for the explanation.&lt;BR /&gt;
I setup the alert for every 5 mins for the timerange of last 10 mins and it worked!&lt;BR /&gt;
Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Sat, 18 Nov 2017 06:52:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Creating-alerts/m-p/367480#M11099</guid>
      <dc:creator>Deepz2612</dc:creator>
      <dc:date>2017-11-18T06:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Creating alerts</title>
      <link>https://community.splunk.com/t5/Alerting/Creating-alerts/m-p/367481#M11100</link>
      <description>&lt;P&gt;HI,&lt;/P&gt;

&lt;P&gt;from the Palo Alto Networks App I created search for critical allowed and I have issue to find the alert to do some changes. please advise.&lt;BR /&gt;
Thanks &lt;/P&gt;</description>
      <pubDate>Tue, 30 Oct 2018 18:11:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Creating-alerts/m-p/367481#M11100</guid>
      <dc:creator>AAF</dc:creator>
      <dc:date>2018-10-30T18:11:10Z</dc:date>
    </item>
  </channel>
</rss>

