<?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 disable an alert on an event within &amp;quot;x&amp;quot; time of another event? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-disable-an-alert-on-an-event-within-quot-x-quot-time-of/m-p/266794#M80235</link>
    <description>&lt;P&gt;Sure thing,&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Search 1: This gets us the uninstall event&lt;/STRONG&gt;&lt;BR /&gt;
index=wineventlog sourcetype="WinEventLog:Application" host!=DEV* host!=MIR* host!=TST  host!=TMP* (EventCode=11724 OR EventCode=1034)&lt;BR /&gt;
| rex field=Message "(?s)Product: (?.&lt;EM&gt;) --|(?s)Product\sName:\s(?.&lt;/EM&gt;).\sProduct\sVersion" &lt;BR /&gt;
| rex field=Message "--\s(?.&lt;EM&gt;).|(?.&lt;/EM&gt;).\sProduct\sName:"&lt;BR /&gt;
| rex field=Message "error\sstatus:\s(?\d*)."&lt;BR /&gt;
| eval Software=coalesce(product_name,product_names) &lt;BR /&gt;
| eval Result=coalesce(action,actions)&lt;BR /&gt;
| lookup AccountNameSid objectSid as Sid &lt;BR /&gt;
| eval user=if(isnull(sAMAccountName), "User Not Defined", "")&lt;BR /&gt;
| eval "Uninstalled By"=coalesce(sAMAccountName,user)&lt;BR /&gt;
| search Software="[PRODUCT] Result="&lt;EM&gt;remov&lt;/EM&gt;" error_code="0"&lt;BR /&gt;
| fields _time host Software Result "Uninstalled By" Message&lt;BR /&gt;
| table _time host Software Result "Uninstalled By"&lt;BR /&gt;
| rename _time as "Date/Time" host as Host&lt;BR /&gt;
| convert timeformat="%Y/%m/%d %H:%M:%S" ctime("Date/Time")&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Search 2: This gets us the Install event&lt;/STRONG&gt;&lt;BR /&gt;
index=wineventlog sourcetype="WinEventLog:Application" host!=DEV* host!=MIR* host!=TST host!=TMP* (EventCode=11707 OR EventCode=1033)&lt;BR /&gt;
| rex field=Message "(?s)Product: (?.&lt;EM&gt;) --|(?s)Product\sName:\s(?.&lt;/EM&gt;).\sProduct\sVersion" &lt;BR /&gt;
| rex field=Message "--\s(?.&lt;EM&gt;).|(?.&lt;/EM&gt;).\sProduct\sName:"&lt;BR /&gt;
| rex field=Message "error\sstatus:\s(?\d*)."&lt;BR /&gt;
| eval Software=coalesce(product_name,product_names) &lt;BR /&gt;
| eval Result=coalesce(action,actions)&lt;BR /&gt;
| lookup AccountNameSid objectSid as Sid &lt;BR /&gt;
| eval user=if(isnull(sAMAccountName), "User Not Defined", "")&lt;BR /&gt;
| eval "Installed By"=coalesce(sAMAccountName,user)&lt;BR /&gt;
| search Software="[PRODUCT]*"&lt;BR /&gt;
| fields _time host Software Result "Installed By" Message&lt;BR /&gt;
| table _time host Software Result "Installed By"&lt;BR /&gt;
| rename _time as "Date/Time" host as Host&lt;BR /&gt;
| convert timeformat="%Y/%m/%d %H:%M:%S" ctime("Date/Time")&lt;/P&gt;

&lt;P&gt;Please feel free to modify the searches, there is quite a few things in there to make it more friendly to the people who would read this. Thanks again for the help.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 12:39:27 GMT</pubDate>
    <dc:creator>WoolarCJ</dc:creator>
    <dc:date>2020-09-29T12:39:27Z</dc:date>
    <item>
      <title>How to disable an alert on an event within "x" time of another event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-disable-an-alert-on-an-event-within-quot-x-quot-time-of/m-p/266791#M80232</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;We have 2 searches, one gets us a result that says something along the lines of "this product was removed". The other search gets a result that says "This product was installed". We are wondering if there is a way to &lt;STRONG&gt;not&lt;/STRONG&gt; be alerted when a product  was removed and the same product was reinstalled within say a 5 minute window. Any help and direction is appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 12:02:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-disable-an-alert-on-an-event-within-quot-x-quot-time-of/m-p/266791#M80232</guid>
      <dc:creator>WoolarCJ</dc:creator>
      <dc:date>2017-02-01T12:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to disable an alert on an event within "x" time of another event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-disable-an-alert-on-an-event-within-quot-x-quot-time-of/m-p/266792#M80233</link>
      <description>&lt;P&gt;Yes, it is entirely possible. However, the community will need to see both searches if you want us to help you write the search for the alert. (You can obscure the data, ips, values and even field names if you need to. )&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 21:39:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-disable-an-alert-on-an-event-within-quot-x-quot-time-of/m-p/266792#M80233</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2017-02-01T21:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to disable an alert on an event within "x" time of another event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-disable-an-alert-on-an-event-within-quot-x-quot-time-of/m-p/266793#M80234</link>
      <description>&lt;P&gt;Ten months more experience, and here's how I'd do it today...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ( earliest =-65m@m  latest=@5m index=foo "was removed") OR
 ( earliest =-60m@m  latest=@0m index=foo "was installed")
 | rex "was (?&amp;lt;Status&amp;gt;removed|installed)"
 | stats count(eval(case(Status="removed",1))) as countRem, 
     count(eval(case(Status="installed",1))) as countInst, 
     max(eval(case(Status="removed",_time))) as maxRemTime, 
     min(eval(case(Status="installed",_time))) as minInstTime, 
     max(eval(case(Status="installed",_time))) as maxInstTime 
     by host product
 | eval AlertText = case(countInst==0, "Not Reinstalled after Removal",
     countRem==0, "Installed Okay",
     maxInstTime &amp;lt; maxRemTime, "Not Reinstalled after Removal",
     minInstTime &amp;gt; maxRemTime + 300, "Delayed Reinstall more than 5 minutes"
     true(), "Installed Okay")
 | search AlertText!="Installed Okay"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;This code left here as a warning to others of how sloppy I used to be...&lt;/P&gt;

&lt;P&gt;Here's a largely pseudocoded version of one way you could do it.    I assumed you were running the search hourly, but the only significant thing about the times is that the Removed search time period needs to start 5 min before the Installed search time period starts, and end 5 min before the Installed search does.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest =-65m@m  latest=@5m [search "was removed] 
| ...extract the host and product... 
| stats count as countRem, max(_time) as maxRemTime by host product

| append
    [earliest =-60m@m  latest=@0m [search "was installed"] 
    | ...extract the host and product... 
    | stats count as countInst, min(_time) as minInstTime, max(_time) as maxInstTime by host product
    ] 

| stats sum(countRem) as countRem,  sum(countInst) as countInst, max(maxRemTime) as maxRemTime,
    min(minInstTime) as minInstTime, max(maxInstTime) as maxInstTime by host product
| eval AlertText = case(countInst==0, "Not Reinstalled after Removal",
    countRem==0, "Installed Okay",
    maxInstTime &amp;lt; maxRemTime, "Not Reinstalled after Removal",
    minInstTime &amp;gt; maxRemTime + 300, "Delayed Reinstall more than 5 minutes"
    true(), "Installed Okay")
| search AlertText!="Installed Okay"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Feb 2017 22:50:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-disable-an-alert-on-an-event-within-quot-x-quot-time-of/m-p/266793#M80234</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-02-01T22:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to disable an alert on an event within "x" time of another event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-disable-an-alert-on-an-event-within-quot-x-quot-time-of/m-p/266794#M80235</link>
      <description>&lt;P&gt;Sure thing,&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Search 1: This gets us the uninstall event&lt;/STRONG&gt;&lt;BR /&gt;
index=wineventlog sourcetype="WinEventLog:Application" host!=DEV* host!=MIR* host!=TST  host!=TMP* (EventCode=11724 OR EventCode=1034)&lt;BR /&gt;
| rex field=Message "(?s)Product: (?.&lt;EM&gt;) --|(?s)Product\sName:\s(?.&lt;/EM&gt;).\sProduct\sVersion" &lt;BR /&gt;
| rex field=Message "--\s(?.&lt;EM&gt;).|(?.&lt;/EM&gt;).\sProduct\sName:"&lt;BR /&gt;
| rex field=Message "error\sstatus:\s(?\d*)."&lt;BR /&gt;
| eval Software=coalesce(product_name,product_names) &lt;BR /&gt;
| eval Result=coalesce(action,actions)&lt;BR /&gt;
| lookup AccountNameSid objectSid as Sid &lt;BR /&gt;
| eval user=if(isnull(sAMAccountName), "User Not Defined", "")&lt;BR /&gt;
| eval "Uninstalled By"=coalesce(sAMAccountName,user)&lt;BR /&gt;
| search Software="[PRODUCT] Result="&lt;EM&gt;remov&lt;/EM&gt;" error_code="0"&lt;BR /&gt;
| fields _time host Software Result "Uninstalled By" Message&lt;BR /&gt;
| table _time host Software Result "Uninstalled By"&lt;BR /&gt;
| rename _time as "Date/Time" host as Host&lt;BR /&gt;
| convert timeformat="%Y/%m/%d %H:%M:%S" ctime("Date/Time")&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Search 2: This gets us the Install event&lt;/STRONG&gt;&lt;BR /&gt;
index=wineventlog sourcetype="WinEventLog:Application" host!=DEV* host!=MIR* host!=TST host!=TMP* (EventCode=11707 OR EventCode=1033)&lt;BR /&gt;
| rex field=Message "(?s)Product: (?.&lt;EM&gt;) --|(?s)Product\sName:\s(?.&lt;/EM&gt;).\sProduct\sVersion" &lt;BR /&gt;
| rex field=Message "--\s(?.&lt;EM&gt;).|(?.&lt;/EM&gt;).\sProduct\sName:"&lt;BR /&gt;
| rex field=Message "error\sstatus:\s(?\d*)."&lt;BR /&gt;
| eval Software=coalesce(product_name,product_names) &lt;BR /&gt;
| eval Result=coalesce(action,actions)&lt;BR /&gt;
| lookup AccountNameSid objectSid as Sid &lt;BR /&gt;
| eval user=if(isnull(sAMAccountName), "User Not Defined", "")&lt;BR /&gt;
| eval "Installed By"=coalesce(sAMAccountName,user)&lt;BR /&gt;
| search Software="[PRODUCT]*"&lt;BR /&gt;
| fields _time host Software Result "Installed By" Message&lt;BR /&gt;
| table _time host Software Result "Installed By"&lt;BR /&gt;
| rename _time as "Date/Time" host as Host&lt;BR /&gt;
| convert timeformat="%Y/%m/%d %H:%M:%S" ctime("Date/Time")&lt;/P&gt;

&lt;P&gt;Please feel free to modify the searches, there is quite a few things in there to make it more friendly to the people who would read this. Thanks again for the help.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:39:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-disable-an-alert-on-an-event-within-quot-x-quot-time-of/m-p/266794#M80235</guid>
      <dc:creator>WoolarCJ</dc:creator>
      <dc:date>2020-09-29T12:39:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to disable an alert on an event within "x" time of another event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-disable-an-alert-on-an-event-within-quot-x-quot-time-of/m-p/266795#M80236</link>
      <description>&lt;P&gt;We have done a similar thing using the Splunk &lt;CODE&gt;transaction&lt;/CODE&gt; command. &lt;/P&gt;

&lt;P&gt;You have a base search that returns the "removed" as a a &lt;CODE&gt;startswith&lt;/CODE&gt; and the "installed" as an &lt;CODE&gt;endswith&lt;/CODE&gt; option on the transaction command. Then set a &lt;CODE&gt;maxspan=5m&lt;/CODE&gt; and then finally filter on results where the &lt;STRONG&gt;eventcount&lt;/STRONG&gt; field that is added != 2. &lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 17:16:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-disable-an-alert-on-an-event-within-quot-x-quot-time-of/m-p/266795#M80236</guid>
      <dc:creator>raoul</dc:creator>
      <dc:date>2017-11-28T17:16:31Z</dc:date>
    </item>
  </channel>
</rss>

