<?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: Transactions with different field names in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Transactions-with-different-field-names/m-p/68330#M17111</link>
    <description>&lt;P&gt;I recommend using the &lt;CODE&gt;coalesce()&lt;/CODE&gt; eval function.&lt;/P&gt;</description>
    <pubDate>Thu, 01 Sep 2011 06:28:54 GMT</pubDate>
    <dc:creator>gkanapathy</dc:creator>
    <dc:date>2011-09-01T06:28:54Z</dc:date>
    <item>
      <title>Transactions with different field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transactions-with-different-field-names/m-p/68325#M17106</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
Hoping this is something simple that I'm not understanding.&lt;/P&gt;

&lt;P&gt;Example Data:&lt;/P&gt;

&lt;P&gt;Sourcetype=A Sport1=baseball&lt;/P&gt;

&lt;P&gt;SourceType=B Sport2=baseball&lt;/P&gt;

&lt;P&gt;How can I perform a transaction where sport1 and sport2 have the same value. The way I have gotten around this is by doing the following with append but I was thinking there has to be a better way that might be built into the transaction command&lt;/P&gt;

&lt;P&gt;sourcetype=a | eval Sport=Sport1 | append [ search sourcetype=b | eval Sport=Sport2 ] | transaction Sport&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2011 20:49:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transactions-with-different-field-names/m-p/68325#M17106</guid>
      <dc:creator>cramasta</dc:creator>
      <dc:date>2011-08-31T20:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: Transactions with different field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transactions-with-different-field-names/m-p/68326#M17107</link>
      <description>&lt;P&gt;I have always used rename to align different fields. It's not built into transaction, but it should be very speedy. Rename is going to be able to tear through the renaming worlds faster than transaction will be able to deal with them. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=a OR sourcetype=b Sport1=* OR Sport2=* | rename Sport1 as Sport | rename Sport2 as Sport | transaction Sport
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you did want to keep the original field names, one minor comment: if both sourcetypes are in the same index, you will get better performance out of your search by adjusting it to:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=a OR sourcetype=b Sport1=* OR Sport2=* | eval Sport=if(len(Sport1)&amp;gt;0,Sport1,if(len(Sport2)&amp;gt;0,Sport2,"")) | transaction Sport
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Avoiding append, join and subsearch is a great way to improve performance, in general. &lt;/P&gt;

&lt;P&gt;Let me know if you have any questions.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2011 20:59:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transactions-with-different-field-names/m-p/68326#M17107</guid>
      <dc:creator>David</dc:creator>
      <dc:date>2011-08-31T20:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: Transactions with different field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transactions-with-different-field-names/m-p/68327#M17108</link>
      <description>&lt;P&gt;Thanks David,&lt;/P&gt;

&lt;P&gt;Your second answer was exactly what I was looking for&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=a OR sourcetype=b Sport1=* OR Sport2=* | eval Sport=if(len(Sport1)&amp;gt;0,Sport1,if(len(Sport2)&amp;gt;0,Sport2,"")) | transaction Sport
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I did originally try your first suggestion before posting my question but I did not get the results that I expected.   I first ran&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=a OR sourcetype=b Sport1=* OR Sport2=* | rename Sport1 as Sport | rename Sport2 as Sport | transaction Sport
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I found after experimenting was the transaction only used data that belonged to the sourcetype of the last rename command in the search.  So by switching the order of the rename commands I will end up with a different total number of fields in the field picker. I would also see the single sourcetype value change between A and B.&lt;/P&gt;

&lt;P&gt;I was able to somewhat fix this by adding "| table * " before the transaction command&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=a OR sourcetype=b Sport1=* OR Sport2=* | table * | rename Sport1 as Sport | rename Sport2 as Sport | transaction Sport
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What this did was now list the same number of fields in the field picker no matter the order, but the results would still vary depending on the order of the rename commands the transaction.&lt;/P&gt;

&lt;P&gt;Would be happy to show over a webex. &lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2011 04:44:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transactions-with-different-field-names/m-p/68327#M17108</guid>
      <dc:creator>cramasta</dc:creator>
      <dc:date>2011-09-01T04:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: Transactions with different field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transactions-with-different-field-names/m-p/68328#M17109</link>
      <description>&lt;P&gt;this worked perfect &lt;/P&gt;

&lt;P&gt;sourcetype=a OR sourcetype=b Sport1=* OR Sport2=* | eval Sport=if(len(Sport1)&amp;gt;0,Sport1,if(len(Sport2)&amp;gt;0,Sport2,"")) | transaction Sport&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2011 04:51:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transactions-with-different-field-names/m-p/68328#M17109</guid>
      <dc:creator>cramasta</dc:creator>
      <dc:date>2011-09-01T04:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: Transactions with different field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transactions-with-different-field-names/m-p/68329#M17110</link>
      <description>&lt;P&gt;I recommend the use of the &lt;CODE&gt;coalesce()&lt;/CODE&gt; eval function.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2011 06:28:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transactions-with-different-field-names/m-p/68329#M17110</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2011-09-01T06:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: Transactions with different field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transactions-with-different-field-names/m-p/68330#M17111</link>
      <description>&lt;P&gt;I recommend using the &lt;CODE&gt;coalesce()&lt;/CODE&gt; eval function.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2011 06:28:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transactions-with-different-field-names/m-p/68330#M17111</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2011-09-01T06:28:54Z</dc:date>
    </item>
  </channel>
</rss>

