<?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 best use streamstats command with optional arguments, reset_after or reset_before? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-best-use-streamstats-command-with-optional-arguments/m-p/206596#M60167</link>
    <description>&lt;P&gt;Double quotes in the evaluation expression within &lt;STRONG&gt;reset_before&lt;/STRONG&gt; or &lt;STRONG&gt;reset_after&lt;/STRONG&gt; should be escaped with backslash (\). Since you are switching by static time in this case you don't need &lt;STRONG&gt;by shift&lt;/STRONG&gt; as a streamstats split field.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; base_search | eval Time=strftime(_time,"%m/%d/%y %H:%M:%S.%3N %p")  | streamstats count as shift reset_after="("match(Time,\"11/01/16 05:14:00.000 AM\")")"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 27 Dec 2016 06:24:10 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2016-12-27T06:24:10Z</dc:date>
    <item>
      <title>How to best use streamstats command with optional arguments, reset_after or reset_before?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-best-use-streamstats-command-with-optional-arguments/m-p/206594#M60165</link>
      <description>&lt;P&gt;Does anyone have an example of how to use: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;reset_after="(" &amp;lt; eval-expression &amp;gt; ")"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;reset_before="(" &amp;lt; eval-expression &amp;gt; ")" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;with &lt;CODE&gt;streamstats&lt;/CODE&gt;? &lt;/P&gt;

&lt;P&gt;For example, I would like to try something to the effects of: &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;_time&lt;/STRONG&gt; , &lt;STRONG&gt;shift&lt;/STRONG&gt; , &lt;STRONG&gt;count&lt;/STRONG&gt;&lt;BR /&gt;
11/1/16 5:11:00.000 PM, DAY, 1&lt;BR /&gt;
11/1/16 5:12:00.000 PM, DAY, 2&lt;BR /&gt;
11/1/16 5:13:00.000 PM, NIGHT, 1&lt;BR /&gt;
11/1/16 5:14:00.000 PM, NIGHT, 2&lt;BR /&gt;
11/1/16 5:15:00.000 PM, NIGHT, 1&lt;BR /&gt;
11/1/16 5:16:00.000 PM, NIGHT, 2&lt;BR /&gt;
11/1/16 5:17:00.000 PM, DAY, 1&lt;BR /&gt;
11/1/16 5:18:00.000 PM, NIGHT, 3&lt;/P&gt;

&lt;P&gt;where the value of eval-expression would be reset after 11/1/16 5:14:00.000 PM (in epoch format or else) in this case. &lt;/P&gt;

&lt;P&gt;Thank you thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2016 23:37:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-best-use-streamstats-command-with-optional-arguments/m-p/206594#M60165</guid>
      <dc:creator>MsherVin</dc:creator>
      <dc:date>2016-11-01T23:37:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to best use streamstats command with optional arguments, reset_after or reset_before?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-best-use-streamstats-command-with-optional-arguments/m-p/206595#M60166</link>
      <description>&lt;P&gt;So I had a bit of a play around with this data set. I got part way to the answer. When I converted the timestamp to epoch it seemed to give the expected result using the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base_search | eval Time=_time | streamstats count by shift reset_on_change="Time=1478020440"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However when trying to use the _time field, it did not give the same result. I also had problems when using strings in general. Perhaps you can only use numbers?? Anyone else have a solution for use where the field value is a string?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 03:55:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-best-use-streamstats-command-with-optional-arguments/m-p/206595#M60166</guid>
      <dc:creator>lquinn</dc:creator>
      <dc:date>2016-11-02T03:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to best use streamstats command with optional arguments, reset_after or reset_before?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-best-use-streamstats-command-with-optional-arguments/m-p/206596#M60167</link>
      <description>&lt;P&gt;Double quotes in the evaluation expression within &lt;STRONG&gt;reset_before&lt;/STRONG&gt; or &lt;STRONG&gt;reset_after&lt;/STRONG&gt; should be escaped with backslash (\). Since you are switching by static time in this case you don't need &lt;STRONG&gt;by shift&lt;/STRONG&gt; as a streamstats split field.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; base_search | eval Time=strftime(_time,"%m/%d/%y %H:%M:%S.%3N %p")  | streamstats count as shift reset_after="("match(Time,\"11/01/16 05:14:00.000 AM\")")"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Dec 2016 06:24:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-best-use-streamstats-command-with-optional-arguments/m-p/206596#M60167</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2016-12-27T06:24:10Z</dc:date>
    </item>
  </channel>
</rss>

