<?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 different values of the same field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-different-values-of-the-same-field/m-p/203944#M59260</link>
    <description>&lt;P&gt;Thank you for the answer, i have updated my question, and with my current log, your query does not return 2 transactions. Can you take a quick look ?&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jun 2016 13:59:14 GMT</pubDate>
    <dc:creator>sieutruc</dc:creator>
    <dc:date>2016-06-13T13:59:14Z</dc:date>
    <item>
      <title>Transaction with different values of the same field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-different-values-of-the-same-field/m-p/203940#M59256</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have the log like below :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Jun 13 10:18:59 Debug: IID 917966106 done
Jun 13 10:18:59 Debug: IID 917967047 action 2
Jun 13 10:18:59 Debug: IID 917967047 action 1
Jun 13 10:18:58 Debug: IID 917966106 rewritten to IID 917967047 by engine1
Jun 13 10:18:58 Debug: IID 917966106 action 2
Jun 13 10:18:58 Debug: IID 917966106 action 1
Jun 13 10:18:58 Debug: IID 917966106 start
Jun 13 10:18:56 Debug: IID 817966106 done
Jun 13 10:18:56 Debug: IID 817966106 action 2
Jun 13 10:18:56 Debug: IID 817966106 action 1
Jun 13 10:18:56 Debug: IID 817966106 start
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to group into 2 transaction, normally i can use :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=X | rex field=_raw "Debug: IID (?\d+)" | transaction IID startswith="start" endswith="done"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But the problem is for the second transaction, the field &lt;CODE&gt;IID&lt;/CODE&gt; has 2 values ( &lt;CODE&gt;917966106&lt;/CODE&gt; and &lt;CODE&gt;917967047&lt;/CODE&gt; ) but they belong to the same transaction.&lt;/P&gt;

&lt;P&gt;Can you know how to create a transaction in this case, one containing 4 events and other containing 7 events ?&lt;/P&gt;

&lt;P&gt;i would appreciate any idea !&lt;/P&gt;

&lt;P&gt;UPDATE after the good answer of @sundareshr  : my log looks actually  like &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Jun 13 10:18:59 Debug: IID 917966106 done
Jun 13 10:18:56 Debug: RID 23789 stop
Jun 13 10:18:59 Debug: IID 917967047 action 2
Jun 13 10:18:59 Debug: IID 917967047 action 1
Jun 13 10:18:58 Debug: IID 917966106 rewritten to IID 917967047 by engine1
Jun 13 10:18:58 Debug: IID 917966106 action 2
Jun 13 10:18:58 Debug: IID 917966106 action 1
Jun 13 10:18:58 Debug: IID 917966106 start
Jun 13 10:18:58 Debug: RID 23789 IID 917966106 created
Jun 13 10:18:58 Debug: RID 23789 start details: start connection
Jun 13 10:18:56 Debug: IID 817966106 done
Jun 13 10:18:56 Debug: RID 12345 stop
Jun 13 10:18:56 Debug: IID 817966106 action 2
Jun 13 10:18:56 Debug: IID 817966106 action 1
Jun 13 10:18:56 Debug: RID 12345 IID 817966106 created
Jun 13 10:18:56 Debug: RID 12345 start details: start connection
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;when i tried&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=X | rex field=_raw "Debug: IID (?\d+)" | rex field=_raw "Debug: RID (?\d+)" |rex field=_raw "rewritten to IID (?\d+)" | eventstats first(newid) as newid) by IID | eval IID=if((isnull(newid), IID, newid) | transaction IID RID startswith="start" endswith="done"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It does not give the 2 transaction ( 6 events and 10 events)&lt;BR /&gt;
Can you give me a help again pls ?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 11:20:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-different-values-of-the-same-field/m-p/203940#M59256</guid>
      <dc:creator>sieutruc</dc:creator>
      <dc:date>2016-06-13T11:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction with different values of the same field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-different-values-of-the-same-field/m-p/203941#M59257</link>
      <description>&lt;P&gt;Is the problem that you have two IIDs so that messes things up?&lt;/P&gt;

&lt;P&gt;Do you want to use the LAST IID or the FIRST IID?  Basically, is the above list you wrote two transactions, one for 917966106 with &lt;STRONG&gt;9&lt;/STRONG&gt; events and one for 917967047 with &lt;STRONG&gt;3&lt;/STRONG&gt; events, or is it two transactions one for 917966106 with &lt;STRONG&gt;10&lt;/STRONG&gt; events and one for 917967047 with &lt;STRONG&gt;2&lt;/STRONG&gt; events (i.e. does the line with two get included in the ...106 transaction or the ...047 transaction?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 11:51:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-different-values-of-the-same-field/m-p/203941#M59257</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2016-06-13T11:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction with different values of the same field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-different-values-of-the-same-field/m-p/203942#M59258</link>
      <description>&lt;P&gt;one transaction is 917966106  and 917967047 , and other one is 817966106. 917967047 is rewritten from 917966106 but both are in the same transaction. So first transaction contain 4 events and other contains 7 events.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 12:06:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-different-values-of-the-same-field/m-p/203942#M59258</guid>
      <dc:creator>sieutruc</dc:creator>
      <dc:date>2016-06-13T12:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction with different values of the same field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-different-values-of-the-same-field/m-p/203943#M59259</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=X | rex field=_raw "Debug: IID (?&amp;lt;IID&amp;gt;\d+)" |rex field=_raw "rewritten to IID (?&amp;lt;newId&amp;gt;\d+)" | eventstats first(newid) as newid) by IID | eval IID=if((isnull(newid), IID, newid) | transaction IID startswith="start" endswith="done"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jun 2016 13:09:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-different-values-of-the-same-field/m-p/203943#M59259</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-06-13T13:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction with different values of the same field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-different-values-of-the-same-field/m-p/203944#M59260</link>
      <description>&lt;P&gt;Thank you for the answer, i have updated my question, and with my current log, your query does not return 2 transactions. Can you take a quick look ?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 13:59:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-different-values-of-the-same-field/m-p/203944#M59260</guid>
      <dc:creator>sieutruc</dc:creator>
      <dc:date>2016-06-13T13:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction with different values of the same field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-different-values-of-the-same-field/m-p/203945#M59261</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "RID\s?(?&amp;lt;rid&amp;gt;\d+)"  | rex max_match=2 "IID\s?(?&amp;lt;iid&amp;gt;\d+)" | rex "(?&amp;lt;action&amp;gt;start|done)" | eval newid=mvindex(iid, 1) | eval iid=mvindex(iid, 0) | eventstats first(newid) as newids by iid | eval iids=if(isnull(newids), iid, newids) | eventstats first(iids) as iids by rid | transaction iids
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jun 2016 15:01:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-different-values-of-the-same-field/m-p/203945#M59261</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-06-13T15:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction with different values of the same field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-different-values-of-the-same-field/m-p/203946#M59262</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=X | rex field=_raw "Debug: IID (?&amp;lt;origIID&amp;gt;\d+)(?:\s+rewritten to IID (?&amp;lt;newIID&amp;gt;\d+))?"
| eval newIID=coalesce(newIID, origIID)
| eventstats latest(newIID) AS finalIID BY origIID
| transaction finalIID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;BTW, transaction is a very expensive way to do this, I would swap the last line above with this one:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats list(_time)  list(_raw) BY finalIID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or maybe even this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats values(*) AS * values(_*) AS _* BY finalIID
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Jun 2016 15:31:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-different-values-of-the-same-field/m-p/203946#M59262</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-06-14T15:31:00Z</dc:date>
    </item>
  </channel>
</rss>

