<?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 define transaction that begin and end with the same condition? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-define-transaction-that-begin-and-end-with-the-same/m-p/502014#M139741</link>
    <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your Search Here
| streamstats count(eval(YourMarkerFieldHere="YourMarkerValueHere")) AS sessionID
| stats count BY sessionID
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 06 Dec 2019 19:39:01 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-12-06T19:39:01Z</dc:date>
    <item>
      <title>How to define transaction that begin and end with the same condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-define-transaction-that-begin-and-end-with-the-same/m-p/502011#M139738</link>
      <description>&lt;P&gt;We have periodic events of the same kind and I want to count the time (duration) and the number of &lt;EM&gt;other&lt;/EM&gt; events (eventcount) between them. For example, consider streams of events coming from different &lt;CODE&gt;stream&lt;/CODE&gt;s:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;stream=1: Marker
stream=2: Marker
stream=1: Marker
stream=3: Marker
stream=3: Marker
stream=2: Marker
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried using a transaction with the same start- and stop- condition:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;transaction stream startswith=Marker endswith=Marker
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;expecting it to do what I want -- but instead, every such "transaction" has a duration of 0 and event-count of 1. Instead of three transactions in the above example, I got six...&lt;/P&gt;

&lt;P&gt;How can I create a stream of transactions, where the starting event of the next one is &lt;EM&gt;also&lt;/EM&gt; the ending event of the previous?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 23:15:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-define-transaction-that-begin-and-end-with-the-same/m-p/502011#M139738</guid>
      <dc:creator>unitedmarsupial</dc:creator>
      <dc:date>2019-12-05T23:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to define transaction that begin and end with the same condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-define-transaction-that-begin-and-end-with-the-same/m-p/502012#M139739</link>
      <description>&lt;P&gt;@unitedmarsupials &lt;/P&gt;

&lt;P&gt;Sample events and expected output will be help us to work on your issue.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2019 07:13:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-define-transaction-that-begin-and-end-with-the-same/m-p/502012#M139739</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-12-06T07:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to define transaction that begin and end with the same condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-define-transaction-that-begin-and-end-with-the-same/m-p/502013#M139740</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults count=2 
| streamstats count 
| eval _time=if((count == 2),relative_time('_time',"-1@d"),relative_time('_time',"@m")) 
| makecontinuous span=1m 
| eval stream=((random() % 3) + 1)
`comment("this is sample data")`
| streamstats count
| xyseries count stream _time
| sort count
| eval count=1
| stats delim="," list(*) as stream* by count
| eval count=max(mvcount(stream1),mvcount(stream2),mvcount(stream3))
| eval counter=mvrange(1,count)
| mvexpand counter
| foreach stream*
    [eval stream_&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt; = mvindex(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;,counter - 1)]
| autoregress stream_1 as stream_1_p
| autoregress stream_2 as stream_2_p
| autoregress stream_3 as stream_3_p
| fields stream_*
| foreach stream_* stream_*_p 
    [eval duration_stream_&amp;lt;&amp;lt;MATCHSEG1&amp;gt;&amp;gt;= round(stream_&amp;lt;&amp;lt;MATCHSEG1&amp;gt;&amp;gt; - stream_&amp;lt;&amp;lt;MATCHSEG1&amp;gt;&amp;gt;_p)]
| foreach stream_* 
    [eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=strftime(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;,"%F %T")]
| fields - stream_*_*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried various things on the premise of extracting the &lt;CODE&gt;stream&lt;/CODE&gt; fields.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2019 19:33:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-define-transaction-that-begin-and-end-with-the-same/m-p/502013#M139740</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2019-12-06T19:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to define transaction that begin and end with the same condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-define-transaction-that-begin-and-end-with-the-same/m-p/502014#M139741</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your Search Here
| streamstats count(eval(YourMarkerFieldHere="YourMarkerValueHere")) AS sessionID
| stats count BY sessionID
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Dec 2019 19:39:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-define-transaction-that-begin-and-end-with-the-same/m-p/502014#M139741</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-12-06T19:39:01Z</dc:date>
    </item>
  </channel>
</rss>

