<?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: Relating 2 different fields within a transaction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Relating-2-different-fields-within-a-transaction/m-p/81817#M20755</link>
    <description>&lt;P&gt;If you are trying to group on field_A AND field_B that have the same value between them (even between sourcetypes), then you could try creating a field alias called "field_Z" to normalize the field name, first, THEN pipe to transaction using field_Z.&lt;/P&gt;

&lt;P&gt;BTW, to setup a field alias, you can go into Splunk &amp;gt;&amp;gt; Manager &amp;gt;&amp;gt; Fields &amp;gt;&amp;gt; Field alias &amp;gt;&amp;gt; New&lt;/P&gt;

&lt;P&gt;and add both field_A and field_B to have an alias of field_Z, save.&lt;/P&gt;</description>
    <pubDate>Tue, 02 Nov 2010 22:02:21 GMT</pubDate>
    <dc:creator>maverick</dc:creator>
    <dc:date>2010-11-02T22:02:21Z</dc:date>
    <item>
      <title>Relating 2 different fields within a transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Relating-2-different-fields-within-a-transaction/m-p/81815#M20753</link>
      <description>&lt;P&gt;I would like to relate 2 different sourcetypes with a common value for a field. The fields are named differently in each sourcetype. For my example I have:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=A OR sourcetype=B|transaction field_A,field_B maxspan=1d connected=f|eval num=mvcount(sourcetype)|where num=2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This means relate all events of sourcetype A to sourcetype B using the extracted field_A and field_B from each respective sourcetype and only show grouped events that have both sourcetypes. So, if field_A=2 and field_B=2 for the allotted time period, there should be a grouping. However, if field_A=3 and field_B=2, there should be no match. If I don't use connected=f, I get no matches at all for 2 different sourcetypes, even when they exist. If I use connected=f, it groups events even if field_A and field_B have different values. The end goal is to group events where field_A==field_B for the same values. What am I doing incorrectly. Here's another more concrete example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="trade_pricing" OR sourcetype="stockquote_entry" |transaction stock_name,stock_symbol connected=f maxspan=1d |eval num=mvcount(sourcetype)|where num=2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The results I get back from a search for a transaction grouping are:&lt;/P&gt;

&lt;PRE&gt;
StockQuotes Stock Symbol GE 11/1/2010 4:02pm Change-0.07
Mon Nov  1 17:20:04 EDT 2010 Looking up price for BAC
Mon Nov  1 17:20:04 EDT 2010 Got price for BAC as 0
Mon Nov  1 17:21:08 EDT 2010 Looking up price for BAC
Mon Nov  1 17:21:08 EDT 2010 Got price for BAC as 0.5



    * host=mac-mbp15.local 
    * sourcetype=stockquote_entry  
    * sourcetype=trade_pricing 
    * source=/Applications/splunk/etc/apps/Trade/logs/pricing.log
    * source=stockquote_xml
    * stock_name=BAC 
    * stock_symbol=GE 
&lt;/PRE&gt;

&lt;P&gt;Notice how stock_name and stock_symbol have different values, but the events are still grouped together. Any explanations?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Nov 2010 05:23:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Relating-2-different-fields-within-a-transaction/m-p/81815#M20753</guid>
      <dc:creator>ndoshi</dc:creator>
      <dc:date>2010-11-02T05:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Relating 2 different fields within a transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Relating-2-different-fields-within-a-transaction/m-p/81816#M20754</link>
      <description>&lt;P&gt;If sourcetype A only contains field_A and sourcetype B only contains field_B, then this might work  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`sourcetype=A OR sourcetype=B|eval mySingleField=coalesce(field_A,field_B)|transaction mySingleField maxspan=1d |eval num=mvcount(sourcetype)|where num=2`
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You just create a new field for all the events that has the same name in both sourcetypes&lt;/P&gt;

&lt;P&gt;I hope this helps&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Tue, 02 Nov 2010 06:10:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Relating-2-different-fields-within-a-transaction/m-p/81816#M20754</guid>
      <dc:creator>chris</dc:creator>
      <dc:date>2010-11-02T06:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: Relating 2 different fields within a transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Relating-2-different-fields-within-a-transaction/m-p/81817#M20755</link>
      <description>&lt;P&gt;If you are trying to group on field_A AND field_B that have the same value between them (even between sourcetypes), then you could try creating a field alias called "field_Z" to normalize the field name, first, THEN pipe to transaction using field_Z.&lt;/P&gt;

&lt;P&gt;BTW, to setup a field alias, you can go into Splunk &amp;gt;&amp;gt; Manager &amp;gt;&amp;gt; Fields &amp;gt;&amp;gt; Field alias &amp;gt;&amp;gt; New&lt;/P&gt;

&lt;P&gt;and add both field_A and field_B to have an alias of field_Z, save.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Nov 2010 22:02:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Relating-2-different-fields-within-a-transaction/m-p/81817#M20755</guid>
      <dc:creator>maverick</dc:creator>
      <dc:date>2010-11-02T22:02:21Z</dc:date>
    </item>
  </channel>
</rss>

