<?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 do I group events based on contiguous runs of field value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-group-events-based-on-contiguous-runs-of-field-value/m-p/422233#M121259</link>
    <description>&lt;P&gt;Actually, this occasionally returns multiple consecutive results with the same name. Could it be that the eventstats is grabbing partial results from the streamstats command before "max_time" is fully resolved?&lt;/P&gt;</description>
    <pubDate>Wed, 10 Oct 2018 17:38:27 GMT</pubDate>
    <dc:creator>reed_kelly</dc:creator>
    <dc:date>2018-10-10T17:38:27Z</dc:date>
    <item>
      <title>How do I group events based on contiguous runs of field value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-group-events-based-on-contiguous-runs-of-field-value/m-p/422231#M121257</link>
      <description>&lt;P&gt;I would like something like a &lt;CODE&gt;stats&lt;/CODE&gt; command that groups events only if they form a contiguous run of a particular field. Suppose I have a sequence of events that have a field called 'name' that appears in the following time-ordered sequence:  A,A,A,A,B,C,B,Y,Y,Y,A,A,A,B,B,B. I would like to do something like:&lt;BR /&gt;
    | stats-like-command count, min(_time), max(_time) by name&lt;/P&gt;

&lt;P&gt;This should produce something like:&lt;BR /&gt;
    A, 4, time1, time2&lt;BR /&gt;
    B, 1, time3, time4&lt;BR /&gt;
    C, 1, time5, time6&lt;BR /&gt;
    B, 1, time7, time8&lt;BR /&gt;
    Y, 3, time9, time10&lt;BR /&gt;
    A, 3, time11, time12&lt;BR /&gt;
    B, 3, time13, time14&lt;/P&gt;

&lt;P&gt;It shouldn't matter how much time is between the events, I just want to collapse based on "runs" within the sequence of events.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:35:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-group-events-based-on-contiguous-runs-of-field-value/m-p/422231#M121257</guid>
      <dc:creator>reed_kelly</dc:creator>
      <dc:date>2020-09-29T21:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I group events based on contiguous runs of field value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-group-events-based-on-contiguous-runs-of-field-value/m-p/422232#M121258</link>
      <description>&lt;P&gt;I think I figured it out.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| streamstats count, min(_time) as min_time, max(_time) as max_time BY name reset_on_change=true
| eventstats max(count) as max_count by max_time, name
| where count=max_count
| convert ctime(*_time)
| table name, count, min_time, max_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For the Karma, feel free to paste this into the answer or provide a better way - Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Oct 2018 14:56:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-group-events-based-on-contiguous-runs-of-field-value/m-p/422232#M121258</guid>
      <dc:creator>reed_kelly</dc:creator>
      <dc:date>2018-10-10T14:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do I group events based on contiguous runs of field value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-group-events-based-on-contiguous-runs-of-field-value/m-p/422233#M121259</link>
      <description>&lt;P&gt;Actually, this occasionally returns multiple consecutive results with the same name. Could it be that the eventstats is grabbing partial results from the streamstats command before "max_time" is fully resolved?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Oct 2018 17:38:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-group-events-based-on-contiguous-runs-of-field-value/m-p/422233#M121259</guid>
      <dc:creator>reed_kelly</dc:creator>
      <dc:date>2018-10-10T17:38:27Z</dc:date>
    </item>
  </channel>
</rss>

