<?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: Streamstats reset_after  not working for me in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Streamstats-reset-after-not-working-when-setting-up-trigger/m-p/516629#M9579</link>
    <description>&lt;P&gt;Looks like you're confusing null here.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are doing Errorcode=* then Errorcode MUST exists and therefore cannot be null, so you will not have any events where isnull(ErrorCode)&lt;/P&gt;&lt;P&gt;Also, you example shows you doing 'errorCode' (lower case 'e') in the test.&lt;/P&gt;&lt;P&gt;However, if ErrorCode is the text 'null' then your if test should be if(ErrorCode="null"...)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Aug 2020 04:00:59 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2020-08-28T04:00:59Z</dc:date>
    <item>
      <title>Streamstats reset_after not working when setting up trigger alert for10 or more error occurrences (ErrorCode).</title>
      <link>https://community.splunk.com/t5/Alerting/Streamstats-reset-after-not-working-when-setting-up-trigger/m-p/516612#M9577</link>
      <description>&lt;P&gt;OK, so this search is reading an input file looking for where the field &lt;STRONG&gt;ErrorCode&lt;/STRONG&gt; has data populated in it.&amp;nbsp; I am trying to count the occurrences of those errors and if they are 10 or more consecutive errors I will be triggering an alert.&lt;BR /&gt;&lt;BR /&gt;Here is the search:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| inputlookup myfile.csv
| eval _time=strptime(RequestDatetime,"%F %T")
| search (RequestDatetime&amp;gt;="2020-08-19" AND RequestDatetime&amp;lt;"2020-08-20")
| search (InfoSourceID="3" OR InfoSourceID="4") AND ErrorCode=*
| streamstats reset_after=(isnull(errorCode)) count
|stats latest(eval(if(count&amp;gt;=10,_time,NULL))) as _time&lt;/LI-CODE&gt;
&lt;P&gt;The &lt;STRONG&gt;ErrorCode&lt;/STRONG&gt; field may or may not have data in it.&amp;nbsp; The requirement is to count 10 or more consecutive errors and trigger an alert.&amp;nbsp; The issue is when testing I added some blank fields to see if the reset_after line would reset the count and it did not.&lt;/P&gt;
&lt;P&gt;For example, the line on the left works fine and triggers an alert.&amp;nbsp; The one on the right triggers an alert but&amp;nbsp; I don't want it to because they are not consecutive.&lt;/P&gt;
&lt;TABLE border="0" width="128" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64" height="19"&gt;ErrorCode&lt;/TD&gt;
&lt;TD width="64"&gt;ErrorCode&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;data&lt;/TD&gt;
&lt;TD&gt;data&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;data&lt;/TD&gt;
&lt;TD&gt;null&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;data&lt;/TD&gt;
&lt;TD&gt;data&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;data&lt;/TD&gt;
&lt;TD&gt;null&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;data&lt;/TD&gt;
&lt;TD&gt;data&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;data&lt;/TD&gt;
&lt;TD&gt;null&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;data&lt;/TD&gt;
&lt;TD&gt;data&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;data&lt;/TD&gt;
&lt;TD&gt;null&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;data&lt;/TD&gt;
&lt;TD&gt;data&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;data&lt;/TD&gt;
&lt;TD&gt;null&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;data&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;null&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;data&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;null&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;data&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;null&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;data&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;null&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;data&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;null&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;data&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Am I using streamstats correctly here?&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2020 18:43:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Streamstats-reset-after-not-working-when-setting-up-trigger/m-p/516612#M9577</guid>
      <dc:creator>irishmanjb</dc:creator>
      <dc:date>2020-08-31T18:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: Streamstats reset_after  not working for me</title>
      <link>https://community.splunk.com/t5/Alerting/Streamstats-reset-after-not-working-when-setting-up-trigger/m-p/516628#M9578</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214488"&gt;@irishmanjb&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think in this case it may be simpler to only look at the previous 10 events and then use a group by clause on the ErrorCode and with reset_on_change to true, as shown ...&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;...
| streamstats window=10 count(eval(if(isnotnull(ErrorCode), 1, null() ))) reset_on_change=true BY ErrorCode
| where count=10
...&lt;/LI-CODE&gt;&lt;P&gt;Hope this helps&lt;BR /&gt;&lt;BR /&gt;Also note, from your query, this may fix it&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;...
| streamstats reset_after="("isnull(ErrorCode)")" count
...&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 03:59:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Streamstats-reset-after-not-working-when-setting-up-trigger/m-p/516628#M9578</guid>
      <dc:creator>yeahnah</dc:creator>
      <dc:date>2020-08-28T03:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: Streamstats reset_after  not working for me</title>
      <link>https://community.splunk.com/t5/Alerting/Streamstats-reset-after-not-working-when-setting-up-trigger/m-p/516629#M9579</link>
      <description>&lt;P&gt;Looks like you're confusing null here.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are doing Errorcode=* then Errorcode MUST exists and therefore cannot be null, so you will not have any events where isnull(ErrorCode)&lt;/P&gt;&lt;P&gt;Also, you example shows you doing 'errorCode' (lower case 'e') in the test.&lt;/P&gt;&lt;P&gt;However, if ErrorCode is the text 'null' then your if test should be if(ErrorCode="null"...)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 04:00:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Streamstats-reset-after-not-working-when-setting-up-trigger/m-p/516629#M9579</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2020-08-28T04:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: Streamstats reset_after  not working for me</title>
      <link>https://community.splunk.com/t5/Alerting/Streamstats-reset-after-not-working-when-setting-up-trigger/m-p/516630#M9580</link>
      <description>&lt;P&gt;Good point about the search&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;"Errorcode=*"&lt;/SPAN&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;, unless a "null" string is actually the output value in ErrorCode column.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214488"&gt;@irishmanjb&lt;/a&gt;, that will change the query I provided.&amp;nbsp; The eval may need updating depending on the source data.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 04:07:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Streamstats-reset-after-not-working-when-setting-up-trigger/m-p/516630#M9580</guid>
      <dc:creator>yeahnah</dc:creator>
      <dc:date>2020-08-28T04:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: Streamstats reset_after  not working for me</title>
      <link>https://community.splunk.com/t5/Alerting/Streamstats-reset-after-not-working-when-setting-up-trigger/m-p/516669#M9581</link>
      <description>&lt;P&gt;Thanks for pointing that out my that was a typo that I missed.&amp;nbsp; ErrorCode is still the same result.&lt;/P&gt;&lt;P&gt;| streamstats reset_after=(isnull(ErrorCode)) count&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 11:16:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Streamstats-reset-after-not-working-when-setting-up-trigger/m-p/516669#M9581</guid>
      <dc:creator>irishmanjb</dc:creator>
      <dc:date>2020-08-28T11:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: Streamstats reset_after  not working for me</title>
      <link>https://community.splunk.com/t5/Alerting/Streamstats-reset-after-not-working-when-setting-up-trigger/m-p/516670#M9582</link>
      <description>&lt;P&gt;tried this same result&lt;/P&gt;&lt;PRE&gt;| streamstats reset_after="("isnull(ErrorCode)")" count&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Aug 2020 11:17:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Streamstats-reset-after-not-working-when-setting-up-trigger/m-p/516670#M9582</guid>
      <dc:creator>irishmanjb</dc:creator>
      <dc:date>2020-08-28T11:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Streamstats reset_after  not working for me</title>
      <link>https://community.splunk.com/t5/Alerting/Streamstats-reset-after-not-working-when-setting-up-trigger/m-p/516671#M9583</link>
      <description>&lt;P&gt;hmmm ok so all I am trying to do is find 10 consecutive errors&amp;nbsp; in my log so I can trigger an alert. Errors always have something in the ErrorCode field and regular messages do not.&amp;nbsp; Is there a better approach?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 11:20:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Streamstats-reset-after-not-working-when-setting-up-trigger/m-p/516671#M9583</guid>
      <dc:creator>irishmanjb</dc:creator>
      <dc:date>2020-08-28T11:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: Streamstats reset_after  not working for me</title>
      <link>https://community.splunk.com/t5/Alerting/Streamstats-reset-after-not-working-when-setting-up-trigger/m-p/516806#M9584</link>
      <description>&lt;P&gt;good call removing&amp;nbsp;&lt;SPAN&gt;Errorcode=* from search fixed the reset_after issue thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 20:44:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Streamstats-reset-after-not-working-when-setting-up-trigger/m-p/516806#M9584</guid>
      <dc:creator>irishmanjb</dc:creator>
      <dc:date>2020-08-28T20:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Streamstats reset_after  not working for me</title>
      <link>https://community.splunk.com/t5/Alerting/Streamstats-reset-after-not-working-when-setting-up-trigger/m-p/516835#M9585</link>
      <description>&lt;P&gt;The string null in file is totally different thing that “value” null(). Basically you could do first Something like that&lt;/P&gt;&lt;P&gt;eval ErrorCode = if (isnotnull(ErrorCode), if(ErrorCode = “null”, null(), ErrorCode), null())&lt;/P&gt;&lt;P&gt;it changes ErrorCode to value null() if it was string “null”.&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;&lt;P&gt;please check the syntax as I haven’t splunk in my hands to test it.&lt;/P&gt;</description>
      <pubDate>Sat, 29 Aug 2020 08:27:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Streamstats-reset-after-not-working-when-setting-up-trigger/m-p/516835#M9585</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2020-08-29T08:27:37Z</dc:date>
    </item>
  </channel>
</rss>

