<?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: Conditional Transaction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Conditional-Transaction/m-p/259719#M77853</link>
    <description>&lt;P&gt;You could try the &lt;CODE&gt;coalesce()&lt;/CODE&gt; function to &lt;CODE&gt;eval&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your_search | eval my_t_id = coalesce(user, cause) | transaction my_t_id
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, I think that if this is really your data, you'd need to set up some more constraints (time, number of events, start, stop etc) on the transaction. Otherwise it may be so that your transactions will span too many events.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.3/SearchReference/CommonEvalFunctions"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.3/SearchReference/CommonEvalFunctions&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Transaction"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Transaction&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;</description>
    <pubDate>Wed, 23 Mar 2016 10:16:13 GMT</pubDate>
    <dc:creator>kristian_kolb</dc:creator>
    <dc:date>2016-03-23T10:16:13Z</dc:date>
    <item>
      <title>Conditional Transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-Transaction/m-p/259718#M77852</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I'm looking to extract a specific subset of events in my Splunk data.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time=3:01 type=update user=user2
_time=3:01 type=errorMessage cause=user1 data=bar1
_time=3:02 type=errorMessage cause=user1 data=wizz
_time=3:04 type=update user=user7
_time=3:07 type=errorMessage cause=user1 data=pow
_time=3:10 type=update user=user1
_time=3:11 type=update user=user4
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to match &lt;STRONG&gt;cause&lt;/STRONG&gt; in &lt;STRONG&gt;type=errorMessage&lt;/STRONG&gt; to &lt;STRONG&gt;user&lt;/STRONG&gt; in &lt;STRONG&gt;type=update&lt;/STRONG&gt; , so the output for the above is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time=3:01 duration=9 eventcount=4 type=errorMessage cause=user1 data={bar1,wizz,pow} type=update user=user1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any ideas how to have this behavior?&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2016 09:52:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-Transaction/m-p/259718#M77852</guid>
      <dc:creator>zeophlite</dc:creator>
      <dc:date>2016-03-23T09:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-Transaction/m-p/259719#M77853</link>
      <description>&lt;P&gt;You could try the &lt;CODE&gt;coalesce()&lt;/CODE&gt; function to &lt;CODE&gt;eval&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your_search | eval my_t_id = coalesce(user, cause) | transaction my_t_id
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, I think that if this is really your data, you'd need to set up some more constraints (time, number of events, start, stop etc) on the transaction. Otherwise it may be so that your transactions will span too many events.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.3/SearchReference/CommonEvalFunctions"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.3/SearchReference/CommonEvalFunctions&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Transaction"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Transaction&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2016 10:16:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-Transaction/m-p/259719#M77853</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2016-03-23T10:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-Transaction/m-p/259720#M77854</link>
      <description>&lt;P&gt;Interesting - but what if the &lt;STRONG&gt;type=errorMessage&lt;/STRONG&gt; events have a non-null &lt;STRONG&gt;user&lt;/STRONG&gt;, and &lt;STRONG&gt;type=update&lt;/STRONG&gt; have non-null &lt;STRONG&gt;cause&lt;/STRONG&gt; fields?&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2016 11:27:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-Transaction/m-p/259720#M77854</guid>
      <dc:creator>zeophlite</dc:creator>
      <dc:date>2016-03-23T11:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-Transaction/m-p/259721#M77855</link>
      <description>&lt;P&gt;Then the coalesce function will not be what you want. But since the sample data you posted did not have that limitation ... &lt;/P&gt;

&lt;P&gt;There are other ways of accomplishing the desired results, e.g. sub-searches, joins etc. If you post some 'real' events, you will probably get better help.&lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2016 11:35:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-Transaction/m-p/259721#M77855</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2016-03-23T11:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-Transaction/m-p/259722#M77856</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | eval commonfield=if(type="update",user,cause) | transaction commonfield 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Mar 2016 14:12:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-Transaction/m-p/259722#M77856</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-03-23T14:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-Transaction/m-p/259723#M77857</link>
      <description>&lt;P&gt;That would not differ in effect from coalesce() in case there are non-null user/cause fields in the 'wrong' events.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2016 21:08:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-Transaction/m-p/259723#M77857</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2016-03-23T21:08:37Z</dc:date>
    </item>
  </channel>
</rss>

