<?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 filter non repeating events? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204521#M59406</link>
    <description>&lt;P&gt;@rajkumar_2 - If javiergn's answer helped solve your question, please don't forget to click "Accept" below the answer. Thank you.&lt;/P&gt;</description>
    <pubDate>Sat, 24 Dec 2016 04:47:44 GMT</pubDate>
    <dc:creator>aaraneta_splunk</dc:creator>
    <dc:date>2016-12-24T04:47:44Z</dc:date>
    <item>
      <title>How to filter non repeating events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204515#M59400</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;This an output from a summary index.    From this table, we need to filter based on which exception not occurred continuously. i.e. at &lt;STRONG&gt;9:25,  ORA-17002 and Connection Unavailable&lt;/STRONG&gt; not occurred.  Pls help us to find out how to filter only those events as of latest time.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time   orig_index  ip  port    exceptions
2016-12-21T09:15:00.000-0800    applog  192.168.168.146 9900    GET Request - Method failed
2016-12-21T09:15:00.000-0800    applog  192.168.168.147 9800    GET Request - Method failed
2016-12-21T09:15:00.000-0800    applog  192.168.168.147 9900    GET Request - Method failed
2016-12-21T09:15:00.000-0800    applog  192.168.168.27   9300   Connection Unavailable
2016-12-21T09:15:00.000-0800    applog  192.168.168.27   9300   ORA-17002
2016-12-21T09:20:00.000-0800    applog  192.168.168.146 9900    GET Request - Method failed
2016-12-21T09:20:00.000-0800    applog  192.168.168.147 9800    GET Request - Method failed
2016-12-21T09:20:00.000-0800    applog  192.168.168.27   9300   Connection Unavailable
2016-12-21T09:25:00.000-0800    applog  192.168.168.146 9900    GET Request - Method failed
2016-12-21T09:25:00.000-0800    applog  192.168.168.147 9800    GET Request - Method failed
2016-12-21T09:25:00.000-0800    applog  192.168.168.147 9900    GET Request - Method failed
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Dec 2016 18:27:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204515#M59400</guid>
      <dc:creator>rajkumar_2</dc:creator>
      <dc:date>2016-12-21T18:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter non repeating events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204516#M59401</link>
      <description>&lt;P&gt;Try this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | stats count(exceptions) as count list(_time) as time list(orig_index) as orig_index list(ip) as ip list(exceptions) as exceptions | where count = 1 | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Dec 2016 19:30:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204516#M59401</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-12-21T19:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter non repeating events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204517#M59402</link>
      <description>&lt;P&gt;See if the following helps:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search
| eval value = "+"
| xyseries _time exceptions value
| fillnull value="-"
| streamstats current=f window=1 values(*) as previous_*
| foreach previous_* [eval "&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;" = '&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;' . '&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;']
| fields - previous_*
| untable _time exceptions value
| where value = "+-" OR value = "-+"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is the output I'm getting based on your sample above (see picture below).&lt;BR /&gt;
I understand you just want to highlight those exceptions not happening sequentially and therefore:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;You DO NOT care about ORA-17002 not happening at 09:25 because it DIDN'T happen at 09:20.&lt;/LI&gt;
&lt;LI&gt;You DO care about ORA-17002 not happening at 09:20 because it DID happen at 09:15.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2267iAEC10FCF575A7460/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;EDIT to include remaining fields as requested:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YOUR BASE SEARCH HERE
| append [ 
   YOUR BASE SEARCH AGAIN HERE
   | eval value = "+"
   | xyseries _time exceptions value
   | fillnull value="-"
   | streamstats current=f window=1 values(*) as previous_*
   | foreach previous_* [eval "&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;" = '&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;' . '&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;']
   | fields - previous_*
   | untable _time exceptions value
   | where value = "+-" OR value = "-+"
   | eval isNonRepeating = 1
   | fields - value ]
| stats values(eval(if(isNonRepeating=1, _time, null()))) as _time, values(ip) as ip, values(orig_index) as orig_index, values(port) as port by exceptions
| where isNotNull(_time)
| rename _time as nonRepeatingTime
| eval nonRepeatingTime=strptime(nonRepeatingTime, "%Y-%m-%dT%H:%M:%S.%3N%z")
| fieldformat nonRepeatingTime=strftime(nonRepeatingTime, "%Y-%m-%d %H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please note I'm using strptime and strftime in the last two lines to present time in the format I want but you can probably ignore that.&lt;BR /&gt;
Output I'm getting when I replicate this in my lab:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2268i055D518DEF0B270C/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2016 19:37:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204517#M59402</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-12-21T19:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter non repeating events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204518#M59403</link>
      <description>&lt;P&gt;This "exception not occurred continuously" is based on ip/port OR just overall?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2016 19:59:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204518#M59403</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-12-21T19:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter non repeating events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204519#M59404</link>
      <description>&lt;P&gt;Thank you. appreciate your help. this is the query we need.   Can you please let me know how to add the corresponding orig_index, ip and port too?.  This is used for sending recovery alert(since the exception not happened again), we need to provide details like for which ip, port and index, the exception recovered.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2016 06:34:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204519#M59404</guid>
      <dc:creator>rajkumar_2</dc:creator>
      <dc:date>2016-12-22T06:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter non repeating events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204520#M59405</link>
      <description>&lt;P&gt;I have updated my answer above to see if that helps&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2016 12:29:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204520#M59405</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-12-23T12:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter non repeating events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204521#M59406</link>
      <description>&lt;P&gt;@rajkumar_2 - If javiergn's answer helped solve your question, please don't forget to click "Accept" below the answer. Thank you.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Dec 2016 04:47:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204521#M59406</guid>
      <dc:creator>aaraneta_splunk</dc:creator>
      <dc:date>2016-12-24T04:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter non repeating events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204522#M59407</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;Thank you for your reply.&lt;/P&gt;

&lt;P&gt;The stats is not working as I'm working on summary index.  the summary index "summary_exceptions" is populated using, &lt;BR /&gt;
"...| sistats  count by index, host, cobrand_port, exceptions, threshold".&lt;/P&gt;

&lt;P&gt;Now to send alert, we use:&lt;BR /&gt;
index="summary_exceptions" | eval time=_time | convert timeformat="%Y-%m-%d %H:%M:%S" ctime(time) | stats  count by time, orig_index, orig_host, cobrand_port, exceptions, threshold | where count &amp;gt; threshold |  lookup  exceptions exceptions OUTPUT severity | rename cobrand_port as port orig_host as ip| eval severity=if(severity=1, "Critical", "Warning") | where severity="Critical"&lt;/P&gt;

&lt;P&gt;The output is:&lt;BR /&gt;
time    orig_index  ip  port    exceptions  threshold   count   severity&lt;BR /&gt;
2016-12-27 04:05:00 fe_server   172.17.22.107   9743    ORA-00028   1   2   Critical&lt;BR /&gt;
2016-12-27 04:05:00 fe_server   172.17.22.146   9943    ALERT:Price GET Request - Method failed 1   8   Critical&lt;BR /&gt;
2016-12-27 04:05:00 fe_server   172.17.22.147   9843    ALERT:Price GET Request - Method failed 1   10  Critical&lt;BR /&gt;
2016-12-27 04:05:00 fe_server   172.17.22.147   9943    ALERT:Price GET Request - Method failed 1   4   Critical&lt;BR /&gt;
2016-12-27 04:10:00 fe_server   172.17.22.146   9943    ALERT:Price GET Request - Method failed 1   8   Critical&lt;BR /&gt;
2016-12-27 04:10:00 fe_server   172.17.22.147   9843    ALERT:Price GET Request - Method failed 1   4   Critical&lt;BR /&gt;
2016-12-27 04:10:00 fe_server   172.17.22.147   9943    ALERT:Price GET Request - Method failed 1   4   Critical&lt;/P&gt;

&lt;P&gt;We need to send recovery alert now for ORA-00028 since it din't occur at 4:10 with all other info like ip, port etc.  Can you please update the query and let me know.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:12:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204522#M59407</guid>
      <dc:creator>rajkumar_2</dc:creator>
      <dc:date>2020-09-29T12:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter non repeating events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204523#M59408</link>
      <description>&lt;P&gt;Hi, what's the exact query you are running? Can you post it here?&lt;/P&gt;

&lt;P&gt;I just tried to replicate your sample above by using the following CSV:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;time, orig_index, ip, port, exceptions, threshold, count, severity
2016-12-27 04:05:00, fe_server, 172.17.22.107, 9743, ORA-00028, 1, 2, Critical
2016-12-27 04:05:00, fe_server, 172.17.22.146, 9943, ALERT:Price GET Request - Method failed, 1, 8, Critical
2016-12-27 04:05:00, fe_server, 172.17.22.147, 9843, ALERT:Price GET Request - Method failed, 1, 10, Critical
2016-12-27 04:05:00, fe_server, 172.17.22.147, 9943, ALERT:Price GET Request - Method failed, 1, 4, Critical
2016-12-27 04:10:00, fe_server, 172.17.22.146, 9943, ALERT:Price GET Request - Method failed, 1, 8, Critical
2016-12-27 04:10:00, fe_server, 172.17.22.147, 9843, ALERT:Price GET Request - Method failed, 1, 4, Critical
2016-12-27 04:10:00, fe_server, 172.17.22.147, 9943, ALERT:Price GET Request - Method failed, 1, 4, Critical
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And the same query I posted before but renaming time to _time:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputcsv mycsv.csv | rename time AS _time
| append [ 
   | inputcsv mycsv.csv | rename time AS _time
   | eval value = "+"
   | xyseries _time exceptions value
   | fillnull value="-"
   | streamstats current=f window=1 values(*) as previous_*
   | foreach previous_* [eval "&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;" = '&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;' . '&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;']
   | fields - previous_*
   | untable _time exceptions value
   | where value = "+-" OR value = "-+"
   | eval isNonRepeating = 1
   | fields - value ]
| stats values(eval(if(isNonRepeating=1, _time, null()))) as _time, values(ip) as ip, values(orig_index) as orig_index, values(port) as port by exceptions
| where isNotNull(_time)
| rename _time as nonRepeatingTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And it seems to be working fine. Output:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;exceptions  nonRepeatingTime    ip  orig_index  port
ORA-00028   2016-12-27 04:10:00     172.17.22.107   fe_server   9743 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So not sure why you are having any problems.&lt;/P&gt;

&lt;P&gt;By looking at your alert query, I came up with the following search (I'm sure this can be improved but I don't have access to your raw data):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="summary_exceptions" 
| bucket span=1s _time
| stats count by _time, orig_index, orig_host, cobrand_port, exceptions, threshold 
| where count &amp;gt; threshold 
| lookup exceptions exceptions OUTPUT severity 
| rename cobrand_port as port orig_host as ip
| where severity=1
| eval severity="Critical"
| append [ 
   | search index="summary_exceptions" 
   | bucket span=1s _time
   | stats count by _time, orig_index, orig_host, cobrand_port, exceptions, threshold 
   | where count &amp;gt; threshold 
   | lookup exceptions exceptions OUTPUT severity 
   | rename cobrand_port as port orig_host as ip
   | where severity=1
   | eval severity="Critical"
   | eval value = "+"
   | xyseries _time exceptions value
   | fillnull value="-"
   | streamstats current=f window=1 values(*) as previous_*
   | foreach previous_* [eval "&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;" = '&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;' . '&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;']
   | fields - previous_*
   | untable _time exceptions value
   | where value = "+-" OR value = "-+"
   | eval isNonRepeating = 1
   | fields - value ]
| stats values(eval(if(isNonRepeating=1, _time, null()))) as _time, values(ip) as ip, values(orig_index) as orig_index, values(port) as port by exceptions
| where isNotNull(_time)
| rename _time as nonRepeatingTime
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 01 Jan 2017 11:59:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204523#M59408</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2017-01-01T11:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter non repeating events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204524#M59409</link>
      <description>&lt;P&gt;Thank you. It works fine and this would be enough now to start with.  Appreciate your help on this.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jan 2017 13:20:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-non-repeating-events/m-p/204524#M59409</guid>
      <dc:creator>rajkumar_2</dc:creator>
      <dc:date>2017-01-02T13:20:29Z</dc:date>
    </item>
  </channel>
</rss>

