<?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 streamstats: reset_after function didn't work,[streamstats]: reset_after doesn't works in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/streamstats-reset-after-function-didn-t-work-streamstats-reset/m-p/268925#M176794</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;
I try to use the function reset_after="("&amp;lt;'eval-expression'&amp;gt;")" of the command streamchart but it didn't work. I want to use this function when the field "description" contains "session is closed". I tried a lot of code, like this one:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|streamstats reset_after="("eval(description="session is closed")")" last(beam_number) as "beam"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but splunk always says "&lt;EM&gt;Error in 'streamstats' command: The expression is malformed. Expected ).&lt;/EM&gt;" I don't know how I have to write that? &lt;BR /&gt;
Thanks for the help &lt;/P&gt;</description>
    <pubDate>Thu, 08 Sep 2016 14:19:30 GMT</pubDate>
    <dc:creator>audherma</dc:creator>
    <dc:date>2016-09-08T14:19:30Z</dc:date>
    <item>
      <title>streamstats: reset_after function didn't work,[streamstats]: reset_after doesn't works</title>
      <link>https://community.splunk.com/t5/Splunk-Search/streamstats-reset-after-function-didn-t-work-streamstats-reset/m-p/268925#M176794</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I try to use the function reset_after="("&amp;lt;'eval-expression'&amp;gt;")" of the command streamchart but it didn't work. I want to use this function when the field "description" contains "session is closed". I tried a lot of code, like this one:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|streamstats reset_after="("eval(description="session is closed")")" last(beam_number) as "beam"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but splunk always says "&lt;EM&gt;Error in 'streamstats' command: The expression is malformed. Expected ).&lt;/EM&gt;" I don't know how I have to write that? &lt;BR /&gt;
Thanks for the help &lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2016 14:19:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/streamstats-reset-after-function-didn-t-work-streamstats-reset/m-p/268925#M176794</guid>
      <dc:creator>audherma</dc:creator>
      <dc:date>2016-09-08T14:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: streamstats: reset_after function didn't work,[streamstats]: reset_after doesn't works</title>
      <link>https://community.splunk.com/t5/Splunk-Search/streamstats-reset-after-function-didn-t-work-streamstats-reset/m-p/268926#M176795</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|streamstats reset_after="("description="session is closed"")" last(beam_number) as "beam"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|streamstats reset_after="("match(description,"session is closed")")" last(beam_number) as "beam"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Sep 2016 15:30:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/streamstats-reset-after-function-didn-t-work-streamstats-reset/m-p/268926#M176795</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-09-08T15:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: streamstats: reset_after function didn't work,[streamstats]: reset_after doesn't works</title>
      <link>https://community.splunk.com/t5/Splunk-Search/streamstats-reset-after-function-didn-t-work-streamstats-reset/m-p/268927#M176796</link>
      <description>&lt;P&gt;Hi, &lt;BR /&gt;
I had already tried this, and I've just tried again, but it didn't work, Splunk's answer is always the same...&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2016 07:06:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/streamstats-reset-after-function-didn-t-work-streamstats-reset/m-p/268927#M176796</guid>
      <dc:creator>audherma</dc:creator>
      <dc:date>2016-09-09T07:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: streamstats: reset_after function didn't work,[streamstats]: reset_after doesn't works</title>
      <link>https://community.splunk.com/t5/Splunk-Search/streamstats-reset-after-function-didn-t-work-streamstats-reset/m-p/268928#M176797</link>
      <description>&lt;P&gt;You would need to escape quotes inside match() evaluation function. Use backslash (\) for the same&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|streamstats reset_after="("match(description,\"session is closed\")")" last(beam_number) as "beam"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|streamstats reset_after="("description==\"session is closed\"")" last(beam_number) as "beam"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Dec 2016 06:04:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/streamstats-reset-after-function-didn-t-work-streamstats-reset/m-p/268928#M176797</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2016-12-27T06:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: streamstats: reset_after function didn't work,[streamstats]: reset_after doesn't works</title>
      <link>https://community.splunk.com/t5/Splunk-Search/streamstats-reset-after-function-didn-t-work-streamstats-reset/m-p/268929#M176798</link>
      <description>&lt;P&gt;Whatever expression you put inside reset_after="("")" should be &lt;BR /&gt;
1) a valid eval statement &lt;BR /&gt;
2) returning only true or false. &lt;BR /&gt;
3) Only if the eval expression returns true the stats will reset. &lt;/P&gt;

&lt;P&gt;I have tried both conditions and they work just fine&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;reset_after="("0==0")"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;reset_after="("\"0\"==\"0\"")"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Following are couple of examples which should always work:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Example 1: Reset count after every event i.e. 0==0&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|gentimes start=12/01/2016 end=12/10/2016
| eval testCount=1
| accum testCount
| eval flag=if(0==0,"Reset Counter","Increment Counter")
| sort _time
| streamstats count as Count reset_after="("0==0")" 
| table starthuman testCount flag Count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Example 2: Reset count after every alternate event i.e. even events  i.e Modular division by 2 (testCount%2)&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=12/01/2016 end=12/10/2016
| eval testCount=1
| accum testCount
| eval flag=if(testCount%2=0,"Reset Counter","Increment Counter")
| sort _time
| streamstats count as Count reset_after="("testCount%2=0")" 
| table starthuman testCount flag Count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Dec 2016 05:48:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/streamstats-reset-after-function-didn-t-work-streamstats-reset/m-p/268929#M176798</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2016-12-28T05:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: streamstats: reset_after function didn't work,[streamstats]: reset_after doesn't works</title>
      <link>https://community.splunk.com/t5/Splunk-Search/streamstats-reset-after-function-didn-t-work-streamstats-reset/m-p/268930#M176799</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/201110"&gt;@niketn&lt;/a&gt; - I confirmed this does work as you described while testing in 6.5, whoever reset_after does not seem to work in 6.3.  After reviewing the documentation, "reset_after" was introduced in 6.4.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:12:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/streamstats-reset-after-function-didn-t-work-streamstats-reset/m-p/268930#M176799</guid>
      <dc:creator>tdime</dc:creator>
      <dc:date>2020-09-29T12:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: streamstats: reset_after function didn't work,[streamstats]: reset_after doesn't works</title>
      <link>https://community.splunk.com/t5/Splunk-Search/streamstats-reset-after-function-didn-t-work-streamstats-reset/m-p/268931#M176800</link>
      <description>&lt;P&gt;Are you using Splunk 6.3?&lt;BR /&gt;
Yes you are right reset_before reset_after and reset_on_change were introduced from 6.4.0 onward.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:12:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/streamstats-reset-after-function-didn-t-work-streamstats-reset/m-p/268931#M176800</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-09-29T12:12:19Z</dc:date>
    </item>
  </channel>
</rss>

