<?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: Count of consecutive like events. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119648#M32125</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Let's try something and tell me if it work.&lt;/P&gt;

&lt;P&gt;If your field is &lt;CODE&gt;TypeEvent&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;you search
| streamstats count as NbrOfConsecuviteEvents BY TypeEvent reset_on_change=true
| reverse
| streamstats count as nb BY TypeEvent reset_on_change=true
| where nb=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope it helps&lt;/P&gt;

&lt;P&gt;KailA    &lt;/P&gt;</description>
    <pubDate>Fri, 20 Jul 2018 15:58:32 GMT</pubDate>
    <dc:creator>KailA</dc:creator>
    <dc:date>2018-07-20T15:58:32Z</dc:date>
    <item>
      <title>Count of consecutive like events.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119640#M32117</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;Is there a way to produce a count of consecutive like events in Splunk?&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Example Logs&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;bookingEvent&lt;/P&gt;

&lt;P&gt;bookingEvent&lt;/P&gt;

&lt;P&gt;bookingEvent&lt;/P&gt;

&lt;P&gt;bookingEvent&lt;/P&gt;

&lt;P&gt;failureEvent&lt;/P&gt;

&lt;P&gt;failureEvent&lt;/P&gt;

&lt;P&gt;bookingEvent&lt;/P&gt;

&lt;P&gt;bookingEvent&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Example Desired Output&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;bookingEvent 4&lt;/P&gt;

&lt;P&gt;failureEvent 2&lt;/P&gt;

&lt;P&gt;bookingEvent 2&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2013 09:16:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119640#M32117</guid>
      <dc:creator>topleyg</dc:creator>
      <dc:date>2013-10-29T09:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: Count of consecutive like events.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119641#M32118</link>
      <description>&lt;P&gt;It would be best to assign each value to a field. Then you can do:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;your_search | stats count by type_event&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;where type_event = bookingEvent OR type_event = failureEvent.&lt;/P&gt;

&lt;P&gt;But just based on your raw data above, this should work:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;your_search | rex field=_raw "(?&amp;lt;type_event&amp;gt;\w+)Event" | stats count by type_event&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:07:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119641#M32118</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2020-09-28T15:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: Count of consecutive like events.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119642#M32119</link>
      <description>&lt;P&gt;thanks alacercogitatus, this gives a count of all events over the time period which is not what I want.  I want to produce a count of the consecutive like events.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2013 11:45:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119642#M32119</guid>
      <dc:creator>topleyg</dc:creator>
      <dc:date>2013-10-29T11:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: Count of consecutive like events.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119643#M32120</link>
      <description>&lt;P&gt;Do you have any other data in the log?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2013 11:48:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119643#M32120</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2013-10-29T11:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: Count of consecutive like events.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119644#M32121</link>
      <description>&lt;P&gt;there is other data yes, i have simplified it for the purpose of this question.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2013 12:21:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119644#M32121</guid>
      <dc:creator>topleyg</dc:creator>
      <dc:date>2013-10-29T12:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: Count of consecutive like events.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119645#M32122</link>
      <description>&lt;P&gt;The other data might be needed to properly correlate these events.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2013 12:39:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119645#M32122</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2013-10-29T12:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: Count of consecutive like events.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119646#M32123</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I have similar issue and I have one more column Date with the column he shared.&lt;/P&gt;

&lt;P&gt;Date         :    Status&lt;BR /&gt;
1/1/2018 : Green&lt;BR /&gt;
1/2/2018 : Green&lt;BR /&gt;
1/3/2018 : Red&lt;BR /&gt;
1/4/2018 : Green&lt;BR /&gt;
1/5/2018 : Red&lt;/P&gt;

&lt;P&gt;Desired result is :&lt;BR /&gt;
Status : Count&lt;BR /&gt;
Green : 2&lt;BR /&gt;
Red : 1&lt;BR /&gt;
Green : 1&lt;BR /&gt;
Red : 1&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 13:03:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119646#M32123</guid>
      <dc:creator>abhishekgupta61</dc:creator>
      <dc:date>2018-07-20T13:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: Count of consecutive like events.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119647#M32124</link>
      <description>&lt;P&gt;Let's say your field is  "eventName", try something like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; |  autoregress eventName
 |  eval consecutiveEvent=if(eventName_p1=eventName, 1, 0)
 | streamstats current=t count(eval(consecutiveEvent=0)) AS eventGroup
 |  stats values(eventName) AS eventName, count BY eventGroup
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Jul 2018 13:45:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119647#M32124</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2018-07-20T13:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: Count of consecutive like events.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119648#M32125</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Let's try something and tell me if it work.&lt;/P&gt;

&lt;P&gt;If your field is &lt;CODE&gt;TypeEvent&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;you search
| streamstats count as NbrOfConsecuviteEvents BY TypeEvent reset_on_change=true
| reverse
| streamstats count as nb BY TypeEvent reset_on_change=true
| where nb=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope it helps&lt;/P&gt;

&lt;P&gt;KailA    &lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 15:58:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119648#M32125</guid>
      <dc:creator>KailA</dc:creator>
      <dc:date>2018-07-20T15:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: Count of consecutive like events.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119649#M32126</link>
      <description>&lt;P&gt;Thanks for your help. It works for me.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2018 14:28:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-of-consecutive-like-events/m-p/119649#M32126</guid>
      <dc:creator>abhishekgupta61</dc:creator>
      <dc:date>2018-07-24T14:28:13Z</dc:date>
    </item>
  </channel>
</rss>

