<?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: Tracking multiple transactions in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Tracking-multiple-transactions/m-p/433840#M123863</link>
    <description>&lt;P&gt;I could get your query to produce any results - here is my starting point:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* OR index=_* sourcetype=Terminal.debug OR sourcetype="PaymentGateway*" 
| eval Action =case(match(Info, "^ApplyPayment\(\) - ManagerId.+PaymentId"),"StartTran" ,
    match(Info, "^Done with  Merchant lines"),"EndTran", match(Info, "^Exiting"), "Exiting", 
    match(Info, ""), "Info", 1=1, Action) 
| eval EventTime=strfTime(if(in(Action, "StartTran", "EndTran"), _time,""),"%Y-%m-%d %H:%M:%S.%3N") 
| reverse 
| search Action= "StartTran" OR Action= "EndTran"  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;## this is wrong I need to see what is between these to times....&lt;BR /&gt;
    | sort 0 _time &lt;BR /&gt;
&lt;/CODE&gt;| stats ???? &lt;BR /&gt;
    | table _time Action Info&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jun 2019 18:53:14 GMT</pubDate>
    <dc:creator>dowdag</dc:creator>
    <dc:date>2019-06-27T18:53:14Z</dc:date>
    <item>
      <title>Tracking multiple transactions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Tracking-multiple-transactions/m-p/433833#M123856</link>
      <description>&lt;P&gt;What might a query look like if your data is structured like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.....several events from one or more log files   ......
Jun 18, 11:36:10 "Start Button Pressed"
.....several events from one or more log files ......
Jun 18, 11:38:12 "Stop Button Pressed"
...more events.....
Jun 18, 11:46:10 "Start Button Pressed"
.....several events......
Jun 18, 11:48:12 "Stop Button Pressed"
.....several events......

| eval EventType=case(match(Info, "^Start Button Pressed""),"start" ,match(Info, "^Stop Button Pressed"),"end") 
| search EventType="start" OR  EventType="end"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem with the above 'search' is that it filters out the events that are not Start or Stop.&lt;BR /&gt;
 I need to be able to display all events that occur  between Start and Stop.&lt;/P&gt;

&lt;P&gt;And I need to be able to guarantee that my data is sequential &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| sort 0 d TimeStamp 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks for any suggestions!&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2019 23:07:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Tracking-multiple-transactions/m-p/433833#M123856</guid>
      <dc:creator>dowdag</dc:creator>
      <dc:date>2019-06-18T23:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Tracking multiple transactions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Tracking-multiple-transactions/m-p/433834#M123857</link>
      <description>&lt;P&gt;You can use the transaction command with startswith and endswith:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[YOUR BASE SEARCH HERE]
| transaction someuniqefield startswith="info=Start Button Pressed" endswith="info=Stop Button Pressed"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;someuniquefield should be a field that can be used to identify the transaction.  This will group together events that have the same value of that field from Start Button Pressed to Stop Button Pressed.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 00:16:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Tracking-multiple-transactions/m-p/433834#M123857</guid>
      <dc:creator>kmorris_splunk</dc:creator>
      <dc:date>2019-06-19T00:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Tracking multiple transactions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Tracking-multiple-transactions/m-p/433835#M123858</link>
      <description>&lt;P&gt;Never use &lt;CODE&gt;transaction&lt;/CODE&gt;.  Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=YouShouldAlwaysSpecifyAnIndex AND sourctype=AndSourcetypeToo
| streamstats count(eval(match(Info, "^Stop Button Pressed")))) AS sessionID BY host
| reverse
| stats list(_raw) AS events BY host sessionID
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Jun 2019 00:15:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Tracking-multiple-transactions/m-p/433835#M123858</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-06-24T00:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: Tracking multiple transactions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Tracking-multiple-transactions/m-p/433836#M123859</link>
      <description>&lt;P&gt;I not having much luck with splunk.  However I have been able to extract fields from the various logs but but have had no luck of correlating any of the data and identifying transactions within my data. &lt;/P&gt;

&lt;P&gt;Because there are several teams that own the various software modules that comprise our payment solution I can not easily ask them to add a correlation token all of the  myriad methods calls.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Below is some structure of data:&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;terminal.log - start &lt;BR /&gt;
 Jun 24, 14:39:17.889035, .....  data fields..... "StartPaymentActivity ....... PaymentId(3145735)"&lt;/P&gt;

&lt;P&gt;several other logs *  that are capturing events that are happening in between&lt;BR /&gt;
the start and end.&lt;/P&gt;

&lt;P&gt;2019-06-24 14:39:17,940 .....  data fields.....  Info field captured in splunk&lt;/P&gt;

&lt;P&gt;terminal.log - end&lt;BR /&gt;
Jun 24, 14:40:33.704066, .....  data fields.....    Info field captured --&amp;gt;  "Done with Merchant transaction  no paymentId!!."&lt;/P&gt;

&lt;P&gt;Also note there are more then one transaction in these log files.&lt;/P&gt;

&lt;P&gt;Now I do not fully understand &lt;CODE&gt;splunk transaction or stats commands&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;But I have been trying to  use &lt;CODE&gt;rex with a startswith or endswith&lt;/CODE&gt; is this possible?&lt;/P&gt;

&lt;P&gt;But notice the last two posts one say's use &lt;CODE&gt;transaction&lt;/CODE&gt; and the next one say avoid it and use &lt;CODE&gt;stats&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;The final output I need should look like:&lt;/P&gt;

&lt;P&gt;sourcetype event _time _ paymentId Info -- &lt;STRONG&gt;Start&lt;/STRONG&gt;  Transaction 1&lt;BR /&gt;
sourcetype event _time _ paymentId Info -- data events from different logs&lt;BR /&gt;
sourcetype event _time _ paymentId Info -- &lt;STRONG&gt;End&lt;/STRONG&gt;  Transaction 1&lt;/P&gt;

&lt;P&gt;sourcetype event _time _ paymentId Info -- &lt;STRONG&gt;Start&lt;/STRONG&gt;  Transaction n&lt;BR /&gt;
sourcetype event _time _ paymentId Info -- data events from different logs&lt;BR /&gt;
sourcetype event _time _ paymentId Info -- &lt;STRONG&gt;End&lt;/STRONG&gt;  Transaction n&lt;/P&gt;

&lt;P&gt;Any guidance is appreciated.&lt;BR /&gt;
Thanks in advance for any and all help. &lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2019 23:18:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Tracking-multiple-transactions/m-p/433836#M123859</guid>
      <dc:creator>dowdag</dc:creator>
      <dc:date>2019-06-26T23:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: Tracking multiple transactions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Tracking-multiple-transactions/m-p/433837#M123860</link>
      <description>&lt;P&gt;I think the suggestion that uses streamstats has the assumption that your starts and stops are single threaded.  Would your raw events ever contain situations where the starts/stops can overlap?&lt;/P&gt;

&lt;P&gt;Like:&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;_time_0:   Start Button - Transaction 1&lt;BR /&gt;
_time_1:   Start Button - Transaction 2&lt;BR /&gt;
_time_2:   Stop Button - Transaction 1&lt;BR /&gt;
_time_3:   Stop Button - Transaction 2&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;If there's no overlap, then I can see the streamstats approach working.   However, if there is overlap, the transactions command use of 'someuniquefield' is what helps you.&lt;/P&gt;

&lt;P&gt;(Note: I did not test either of these suggestions to be sure.)&lt;/P&gt;

&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:04:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Tracking-multiple-transactions/m-p/433837#M123860</guid>
      <dc:creator>memarshall63</dc:creator>
      <dc:date>2020-09-30T01:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: Tracking multiple transactions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Tracking-multiple-transactions/m-p/433838#M123861</link>
      <description>&lt;P&gt;All Transactions are sequential .... if there were overlaps this would have not possibility of working at all. &lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 15:20:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Tracking-multiple-transactions/m-p/433838#M123861</guid>
      <dc:creator>dowdag</dc:creator>
      <dc:date>2019-06-27T15:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: Tracking multiple transactions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Tracking-multiple-transactions/m-p/433839#M123862</link>
      <description>&lt;P&gt;Did you even try my solution?  You can worry about understanding it later.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 16:02:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Tracking-multiple-transactions/m-p/433839#M123862</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-06-27T16:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: Tracking multiple transactions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Tracking-multiple-transactions/m-p/433840#M123863</link>
      <description>&lt;P&gt;I could get your query to produce any results - here is my starting point:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* OR index=_* sourcetype=Terminal.debug OR sourcetype="PaymentGateway*" 
| eval Action =case(match(Info, "^ApplyPayment\(\) - ManagerId.+PaymentId"),"StartTran" ,
    match(Info, "^Done with  Merchant lines"),"EndTran", match(Info, "^Exiting"), "Exiting", 
    match(Info, ""), "Info", 1=1, Action) 
| eval EventTime=strfTime(if(in(Action, "StartTran", "EndTran"), _time,""),"%Y-%m-%d %H:%M:%S.%3N") 
| reverse 
| search Action= "StartTran" OR Action= "EndTran"  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;## this is wrong I need to see what is between these to times....&lt;BR /&gt;
    | sort 0 _time &lt;BR /&gt;
&lt;/CODE&gt;| stats ???? &lt;BR /&gt;
    | table _time Action Info&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 18:53:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Tracking-multiple-transactions/m-p/433840#M123863</guid>
      <dc:creator>dowdag</dc:creator>
      <dc:date>2019-06-27T18:53:14Z</dc:date>
    </item>
  </channel>
</rss>

