<?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: Why is streamstats resetting incorrectly twice in the dataset when it should not be? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-is-streamstats-resetting-incorrectly-twice-in-the-dataset/m-p/371105#M109221</link>
    <description>&lt;P&gt;Unfortunately, that causes it to count the instances of ALL "logic_uid"'s together:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;diff    test
0      3
961    13
5      14
418 22
407 4
20  5
23  6
1   7
foo 1
1   2
1   3
8   4
1   5
3   6
3   7
1   8
3   10
1   11
6   12
1   13
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ideally, a single streamstats statement would make the most sense. Sadly, we haven't been able to figure out a way.&lt;/P&gt;</description>
    <pubDate>Fri, 09 Feb 2018 04:02:08 GMT</pubDate>
    <dc:creator>DigitalBibleSoc</dc:creator>
    <dc:date>2018-02-09T04:02:08Z</dc:date>
    <item>
      <title>Why is streamstats resetting incorrectly twice in the dataset when it should not be?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-streamstats-resetting-incorrectly-twice-in-the-dataset/m-p/371103#M109219</link>
      <description>&lt;P&gt;Hey all, we are having a bit of trouble with the &lt;CODE&gt;streamstats&lt;/CODE&gt; command, as the title indicates. The following code returns an uninterrupted descending count in the variable "test", when the reset_before param checks for a value which never can exist ("bar"): &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| from datamodel:"cdnlogic" | streamstats global=f window=2 current=t latest(_time) AS latest_time earliest(_time) AS earliest_time BY logic_uid | eval logic_time_difference = 'latest_time' - 'earliest_time' | eval logic_time_difference = if('logic_time_difference' &amp;gt;= 1200, "foo", 'logic_time_difference') | streamstats global=f window=0 current=t reset_before=("logic_time_difference == \"bar\"") count AS test BY logic_uid  | table logic_time_difference,test
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;returning:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;diff   test
0   1
961 2
5   3
418 4
407 5
20  6
23  7
1   8
foo 9
1   10
1   11
8   12
1   13
3   14
3   15
1   16
3   17
1   18
6   19
1   20 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, when reset_before is changed to look for "foo" instead of "bar", it resets the count incorrectly twice in the dataset I am testing with:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| from datamodel:"cdnlogic" | streamstats global=f window=2 current=t latest(_time) AS latest_time earliest(_time) AS earliest_time BY logic_uid | eval logic_time_difference = 'latest_time' - 'earliest_time' | eval logic_time_difference = if('logic_time_difference' &amp;gt;= 1200, "foo", 'logic_time_difference') | streamstats global=f window=0 current=t reset_before=("logic_time_difference == \"foo\"") count AS test BY logic_uid  | table logic_time_difference,test
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;returns:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;diff   test
0   1
961 1 &amp;lt;-- ?
5   2
418 3
407 1 &amp;lt;-- ?
20  2
23  3
1   4
foo 1 &amp;lt;-- good
1    2
1   3
8   4
1   5
3   6
3   7
1   8
3   9
1   10
6   11
1   12 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any guidance on this issue, as well as consolidating the statement, is welcome.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 23:46:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-streamstats-resetting-incorrectly-twice-in-the-dataset/m-p/371103#M109219</guid>
      <dc:creator>DigitalBibleSoc</dc:creator>
      <dc:date>2018-02-08T23:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: Why is streamstats resetting incorrectly twice in the dataset when it should not be?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-streamstats-resetting-incorrectly-twice-in-the-dataset/m-p/371104#M109220</link>
      <description>&lt;P&gt;It seems due to logic_uid  it getting reset abruptly, so try streamstats without BY clause&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| from datamodel:"cdnlogic" | streamstats global=f window=2 current=t latest(_time) AS latest_time earliest(_time) AS earliest_time BY logic_uid | eval logic_time_difference = 'latest_time' - 'earliest_time' | eval logic_time_difference = if('logic_time_difference' &amp;gt;= 1200, "foo", 'logic_time_difference') | streamstats global=f window=0 current=t reset_before=("logic_time_difference == \"foo\"") count AS test   | table logic_time_difference,test
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Feb 2018 02:21:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-streamstats-resetting-incorrectly-twice-in-the-dataset/m-p/371104#M109220</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-09T02:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: Why is streamstats resetting incorrectly twice in the dataset when it should not be?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-streamstats-resetting-incorrectly-twice-in-the-dataset/m-p/371105#M109221</link>
      <description>&lt;P&gt;Unfortunately, that causes it to count the instances of ALL "logic_uid"'s together:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;diff    test
0      3
961    13
5      14
418 22
407 4
20  5
23  6
1   7
foo 1
1   2
1   3
8   4
1   5
3   6
3   7
1   8
3   10
1   11
6   12
1   13
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ideally, a single streamstats statement would make the most sense. Sadly, we haven't been able to figure out a way.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 04:02:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-streamstats-resetting-incorrectly-twice-in-the-dataset/m-p/371105#M109221</guid>
      <dc:creator>DigitalBibleSoc</dc:creator>
      <dc:date>2018-02-09T04:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: Why is streamstats resetting incorrectly twice in the dataset when it should not be?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-streamstats-resetting-incorrectly-twice-in-the-dataset/m-p/371106#M109222</link>
      <description>&lt;P&gt;have a look at this answer &lt;A href="https://answers.splunk.com/answers/516142/can-streamstats-reset-before-or-reset-after-be-use.html"&gt;https://answers.splunk.com/answers/516142/can-streamstats-reset-before-or-reset-after-be-use.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 04:13:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-streamstats-resetting-incorrectly-twice-in-the-dataset/m-p/371106#M109222</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-09T04:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: Why is streamstats resetting incorrectly twice in the dataset when it should not be?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-streamstats-resetting-incorrectly-twice-in-the-dataset/m-p/371107#M109223</link>
      <description>&lt;P&gt;We did take a look at that before posting this. I'll personally take a closer look at it now/tomorrow and mark as answer if that's the key. Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 04:20:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-streamstats-resetting-incorrectly-twice-in-the-dataset/m-p/371107#M109223</guid>
      <dc:creator>DigitalBibleSoc</dc:creator>
      <dc:date>2018-02-09T04:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: Why is streamstats resetting incorrectly twice in the dataset when it should not be?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-streamstats-resetting-incorrectly-twice-in-the-dataset/m-p/371108#M109224</link>
      <description>&lt;P&gt;Okay, that answer seems specific to counts. The actual logic we are attempting to accomplish against the dataset is not as simple as a count. In order to make the question easier to illustrate, I changed the more complex (and assumed irrelevant) logic to a count so the table output would make sense. In actuality, we are taking a &lt;CODE&gt;sum('logic_time_difference') AS logic_time_sum&lt;/CODE&gt; up to the reset point, AND taking the &lt;CODE&gt;latest('logic_nid') AS logic_nid&lt;/CODE&gt;, replacing the existing 'logic_nid' field of the events inside the series.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 16:33:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-streamstats-resetting-incorrectly-twice-in-the-dataset/m-p/371108#M109224</guid>
      <dc:creator>DigitalBibleSoc</dc:creator>
      <dc:date>2018-02-09T16:33:32Z</dc:date>
    </item>
  </channel>
</rss>

