<?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: Transaction with count of successive events in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-count-of-successive-events/m-p/223511#M65811</link>
    <description>&lt;P&gt;So you need them bounded by intervening, non-matching events?  What I mean by that is that you want to not have a transaction cross another item - so an ID4 splits that ID3/name1 into two chunks, the before one and after one.  Right?&lt;/P&gt;

&lt;P&gt;If so, I'd recommend using streamstats to split your events by counting number of distinct IDs in a two-item streamstats group.  The short version:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | streamstats window=2 distinct_count(ID) AS splitter| transaction startswith=splitter&amp;gt;1 ID name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The longer version: I answered another question a while back with a similar solution that has explanations, so please &lt;A href="https://answers.splunk.com/answers/243789/calculate-transaction-time-for-repeating-events.html#answer-243845"&gt;refer to this answer here&lt;/A&gt; for more information.&lt;/P&gt;

&lt;P&gt;Let me know how it goes or if you need help with some tweaking!&lt;/P&gt;</description>
    <pubDate>Tue, 10 Nov 2015 16:12:43 GMT</pubDate>
    <dc:creator>Richfez</dc:creator>
    <dc:date>2015-11-10T16:12:43Z</dc:date>
    <item>
      <title>Transaction with count of successive events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-count-of-successive-events/m-p/223507#M65807</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;If I have several events like this:&lt;/P&gt;

&lt;P&gt;ID1 name1 &lt;BR /&gt;
 ID2 name2 &lt;BR /&gt;
 ID3 name1 &lt;BR /&gt;
 ID3 name1 &lt;BR /&gt;
 ID3 name1 &lt;BR /&gt;
 ID4 name3 &lt;BR /&gt;
 ID3 name1 &lt;/P&gt;

&lt;P&gt;I would like to have the number of successive events by ID and by Name. So it will give me something like this:&lt;/P&gt;

&lt;P&gt;ID1 name1  1 &lt;BR /&gt;
ID2 name2  1&lt;BR /&gt;
ID3 name1  3&lt;BR /&gt;
ID4 name3  1 &lt;BR /&gt;
ID3 name1  1 &lt;/P&gt;

&lt;P&gt;My problem is with the transaction. It will regroup every identical ID instead of regrouping events that are successive, with the same ID and name.&lt;/P&gt;

&lt;P&gt;Can someone help me? &lt;BR /&gt;
Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 10:25:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-count-of-successive-events/m-p/223507#M65807</guid>
      <dc:creator>chrispappo</dc:creator>
      <dc:date>2015-11-10T10:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction with count of successive events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-count-of-successive-events/m-p/223508#M65808</link>
      <description>&lt;P&gt;anyone can help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; ?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 15:12:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-count-of-successive-events/m-p/223508#M65808</guid>
      <dc:creator>chrispappo</dc:creator>
      <dc:date>2015-11-10T15:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction with count of successive events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-count-of-successive-events/m-p/223509#M65809</link>
      <description>&lt;P&gt;If those have field names of "ID" and "Name", then the simple way would be &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | stats count by ID, Name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Transaction could be useful in other circumstances (perhaps even on this same data), but isn't probably what you need here.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 15:31:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-count-of-successive-events/m-p/223509#M65809</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2015-11-10T15:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction with count of successive events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-count-of-successive-events/m-p/223510#M65810</link>
      <description>&lt;P&gt;thanks for answering. The problem is with your order the result will be &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ID1 name1 1 
ID2 name2 1
ID3 name1 4
ID4 name3 1 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And I want something like &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ID1 name1 1 
ID2 name2 1
ID3 name1 3
ID4 name3 1 
ID3 name1 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;as you can see it's different from what I want, i want to count ONLY the following events who own the same ID/NAME!&lt;/P&gt;

&lt;P&gt;could you help ? &lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 15:38:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-count-of-successive-events/m-p/223510#M65810</guid>
      <dc:creator>chrispappo</dc:creator>
      <dc:date>2015-11-10T15:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction with count of successive events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-count-of-successive-events/m-p/223511#M65811</link>
      <description>&lt;P&gt;So you need them bounded by intervening, non-matching events?  What I mean by that is that you want to not have a transaction cross another item - so an ID4 splits that ID3/name1 into two chunks, the before one and after one.  Right?&lt;/P&gt;

&lt;P&gt;If so, I'd recommend using streamstats to split your events by counting number of distinct IDs in a two-item streamstats group.  The short version:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | streamstats window=2 distinct_count(ID) AS splitter| transaction startswith=splitter&amp;gt;1 ID name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The longer version: I answered another question a while back with a similar solution that has explanations, so please &lt;A href="https://answers.splunk.com/answers/243789/calculate-transaction-time-for-repeating-events.html#answer-243845"&gt;refer to this answer here&lt;/A&gt; for more information.&lt;/P&gt;

&lt;P&gt;Let me know how it goes or if you need help with some tweaking!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 16:12:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-count-of-successive-events/m-p/223511#M65811</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2015-11-10T16:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction with count of successive events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-count-of-successive-events/m-p/223512#M65812</link>
      <description>&lt;P&gt;I believe you are looking for the eventstats command &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1/SearchReference/eventstats"&gt;http://docs.splunk.com/Documentation/Splunk/6.1/SearchReference/eventstats&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;In your example, something like this may work..`.. | sort idcolname | eventstats count by idcolname | dedup idcolname&lt;/P&gt;

&lt;P&gt;If this doesn't give you what you are looking for, try the streamstats command` &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1/SearchReference/streamstats"&gt;http://docs.splunk.com/Documentation/Splunk/6.1/SearchReference/streamstats&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 16:32:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-count-of-successive-events/m-p/223512#M65812</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2015-11-10T16:32:43Z</dc:date>
    </item>
  </channel>
</rss>

