<?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 problem when using &amp;quot;startswith&amp;quot; in Deployment Architecture</title>
    <link>https://community.splunk.com/t5/Deployment-Architecture/Transaction-problem-when-using-quot-startswith-quot/m-p/98325#M3637</link>
    <description>&lt;P&gt;This issue has been fixed in 4.3.x to get the correct behavior you should add: unifyends=true to your transaction command. The idea here is to tell the transaction command that the opening and closing events of a transaction &lt;STRONG&gt;must&lt;/STRONG&gt; also share at least one field value with the rest of the events.&lt;/P&gt;</description>
    <pubDate>Sat, 01 Sep 2012 02:35:20 GMT</pubDate>
    <dc:creator>Ledion_Bitincka</dc:creator>
    <dc:date>2012-09-01T02:35:20Z</dc:date>
    <item>
      <title>Transaction problem when using "startswith"</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Transaction-problem-when-using-quot-startswith-quot/m-p/98323#M3635</link>
      <description>&lt;P&gt;Hi all,
is there any known issue on the &lt;EM&gt;startswith&lt;/EM&gt; clause, when using multiple fields to identify complex transactions? &lt;/P&gt;

&lt;P&gt;In the following case using &lt;EM&gt;endswith&lt;/EM&gt; alone does a good job, but using &lt;EM&gt;startswith&lt;/EM&gt; or both of them will provide incorrect results. &lt;/P&gt;

&lt;P&gt;Here's my case: it's a sample file, manually put together to explore the topic.
Transactions are made by two types of events, those with &lt;EM&gt;tnsid&lt;/EM&gt; "open" the transaction and those with &lt;EM&gt;altid&lt;/EM&gt; "terminate" it. Those events are "chained" by an event having both fields in it. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2010-12-01 08:00:01 - init - tnsid=AAA
2010-12-01 08:00:03 - init - tnsid=BBB
2010-12-01 08:00:05 - mid1 - tnsid=AAA
2010-12-01 08:00:07 - mid1 - tnsid=BBB
2010-12-01 08:00:09 - chain - tnsid=AAA altid=111
2010-12-01 08:00:11 - mid2 - altid=111
2010-12-01 08:00:13 - chain - tnsid=BBB altid=222
2010-12-01 08:00:15 - term - altid=111
2010-12-01 08:00:17 - init - tnsid=CCC
2010-12-01 08:00:19 - mid2 - altid=222
2010-12-01 08:00:21 - mid1 - tnsid=CCC
2010-12-01 08:00:23 - chain - tnsid=CCC altid=555
2010-12-01 08:00:25 - term - altid=222
2010-12-01 08:00:27 - init - tnsid=AAA
2010-12-01 08:00:28 - mid2 - altid=555
2010-12-01 08:00:29 - mid1 - tnsid=AAA
2010-12-01 08:00:30 - chain - tnsid=AAA altid=666
2010-12-01 08:00:35 - term - altid=555
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I can achieve the expected result through the simplest transam command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| file /tmp/tnsexp.log | extract | sort - _time | transam tnsid altid

T1:
2010-12-01 08:00:01 - init - tnsid=AAA
2010-12-01 08:00:05 - mid1 - tnsid=AAA
2010-12-01 08:00:09 - chain - tnsid=AAA altid=111
2010-12-01 08:00:11 - mid2 - altid=111
2010-12-01 08:00:15 - term - altid=111
T2:
2010-12-01 08:00:03 - init - tnsid=BBB
2010-12-01 08:00:07 - mid1 - tnsid=BBB
2010-12-01 08:00:13 - chain - tnsid=BBB altid=222
2010-12-01 08:00:19 - mid2 - altid=222
2010-12-01 08:00:25 - term - altid=222
T3:
2010-12-01 08:00:17 - init - tnsid=CCC
2010-12-01 08:00:21 - mid1 - tnsid=CCC
2010-12-01 08:00:23 - chain - tnsid=CCC altid=555
2010-12-01 08:00:28 - mid2 - altid=555
2010-12-01 08:00:35 - term - altid=555
T4:
2010-12-01 08:00:27 - init - tnsid=AAA
2010-12-01 08:00:29 - mid1 - tnsid=AAA
2010-12-01 08:00:30 - chain - tnsid=AAA altid=666
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The latest is an "open" transaction which should or should not be returned depending on the &lt;EM&gt;keepevicted&lt;/EM&gt; setting, but having Splunk no knowledge about what's an evicted transaction the parameter has no effect. If I wish to code some logic into the command:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;...| transam tnsid altid &lt;STRONG&gt;endswith="term"&lt;/STRONG&gt; -&amp;gt; will provide correct results, keepevicted will correctly control the output of T4, but will leave closed_txn=0 for all of the results&lt;/LI&gt;
&lt;LI&gt;...| transam tnsid altid &lt;STRONG&gt;startswith="init"&lt;/STRONG&gt; -&amp;gt; will break everything&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;----- Here's its output:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2010-12-01 08:00:01 - init - tnsid=AAA
2010-12-01 08:00:05 - mid1 - tnsid=AAA
2010-12-01 08:00:09 - chain - tnsid=AAA altid=111
2010-12-01 08:00:11 - mid2 - altid=111
2010-12-01 08:00:15 - term - altid=111

2010-12-01 08:00:03 - init - tnsid=BBB
2010-12-01 08:00:07 - mid1 - tnsid=BBB
2010-12-01 08:00:13 - chain - tnsid=BBB altid=222

2010-12-01 08:00:17 - init - tnsid=CCC
2010-12-01 08:00:19 - mid2 - altid=222
2010-12-01 08:00:25 - term - altid=222

2010-12-01 08:00:27 - init - tnsid=AAA
2010-12-01 08:00:28 - mid2 - altid=555
2010-12-01 08:00:35 - term - altid=555
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;UL&gt;
&lt;LI&gt;...| transam tnsid altid &lt;STRONG&gt;startswith="init" endswith="term"&lt;/STRONG&gt; -&amp;gt; will still return incorrect results. &lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;----- Here's its output:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2010-12-01 08:00:01 - init - tnsid=AAA
2010-12-01 08:00:05 - mid1 - tnsid=AAA
2010-12-01 08:00:09 - chain - tnsid=AAA altid=111
2010-12-01 08:00:11 - mid2 - altid=111
2010-12-01 08:00:15 - term - altid=111

2010-12-01 08:00:17 - init - tnsid=CCC
2010-12-01 08:00:19 - mid2 - altid=222
2010-12-01 08:00:21 - mid1 - tnsid=CCC
2010-12-01 08:00:25 - term - altid=222

2010-12-01 08:00:27 - init - tnsid=AAA
2010-12-01 08:00:28 - mid2 - altid=555
2010-12-01 08:00:29 - mid1 - tnsid=AAA
2010-12-01 08:00:35 - term - altid=555
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'd need some help in finding out the rationale behind this behaviour...&lt;/P&gt;

&lt;P&gt;Thanks, Paolo&lt;/P&gt;</description>
      <pubDate>Fri, 03 Dec 2010 00:04:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Transaction-problem-when-using-quot-startswith-quot/m-p/98323#M3635</guid>
      <dc:creator>Paolo_Prigione</dc:creator>
      <dc:date>2010-12-03T00:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction problem when using "startswith"</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Transaction-problem-when-using-quot-startswith-quot/m-p/98324#M3636</link>
      <description>&lt;P&gt;So, is you issues with approach 1 simply that you can't determine if the transaction is still open or not?  If so there may be a very simple solution.&lt;/P&gt;

&lt;P&gt;You could determine if the transaction is complete by simply tacking a &lt;CODE&gt;search&lt;/CODE&gt; or &lt;CODE&gt;eval&lt;/CODE&gt; to the end.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| file /tmp/tnsexp.log | extract | sort - _time | transam tnsid altid | eval is_complete=searchmatch("term")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It is much better for performance if you can specify &lt;CODE&gt;startswith&lt;/CODE&gt; or &lt;CODE&gt;endswith&lt;/CODE&gt; because transaction can be evicted once they are complete (uses less memory); but it may be possible to get away without them using appropriate &lt;CODE&gt;maxspan&lt;/CODE&gt; and/or &lt;CODE&gt;maxpause&lt;/CODE&gt; settings.&lt;/P&gt;

&lt;P&gt;I have some more complex approaches that might work here; but they involve subsearches and/or nested transactions, so there's no point going there if the above gets the job done. &lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2011 00:32:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Transaction-problem-when-using-quot-startswith-quot/m-p/98324#M3636</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2011-02-15T00:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction problem when using "startswith"</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Transaction-problem-when-using-quot-startswith-quot/m-p/98325#M3637</link>
      <description>&lt;P&gt;This issue has been fixed in 4.3.x to get the correct behavior you should add: unifyends=true to your transaction command. The idea here is to tell the transaction command that the opening and closing events of a transaction &lt;STRONG&gt;must&lt;/STRONG&gt; also share at least one field value with the rest of the events.&lt;/P&gt;</description>
      <pubDate>Sat, 01 Sep 2012 02:35:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Transaction-problem-when-using-quot-startswith-quot/m-p/98325#M3637</guid>
      <dc:creator>Ledion_Bitincka</dc:creator>
      <dc:date>2012-09-01T02:35:20Z</dc:date>
    </item>
  </channel>
</rss>

