<?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 How to join events with different fields name but same values ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-events-with-different-fields-name-but-same-values/m-p/440894#M125297</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have different sets of events that are linked together and correspond to the same process.&lt;/P&gt;

&lt;P&gt;Field1: One, Two, Three&lt;BR /&gt;
Field2: Four, Five, Six&lt;BR /&gt;
Field3: Seven, Eight, Nine&lt;/P&gt;

&lt;P&gt;FieldA: Four, Five, Six&lt;BR /&gt;
FieldB: Ten, Eleven, Twelve&lt;BR /&gt;
FieldC: First, Second, Third&lt;/P&gt;

&lt;P&gt;FieldX: Ten, Eleven, Twelve&lt;BR /&gt;
FieldY: ABC, DEF, GHI&lt;BR /&gt;
FieldZ: JKL, MNO, PQR&lt;/P&gt;

&lt;P&gt;Field2 and FieldA have the same values but different names.&lt;/P&gt;

&lt;P&gt;I want to display the following table: FieldB/X ; Field2/A ; Field1 ; Field3 ; FieldC ; FieldY ; Field Z&lt;/P&gt;

&lt;P&gt;I can join 2 sets together but I fail to correlate the third.&lt;BR /&gt;
Do you know how to do it?&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Fri, 31 Aug 2018 13:11:37 GMT</pubDate>
    <dc:creator>lyds</dc:creator>
    <dc:date>2018-08-31T13:11:37Z</dc:date>
    <item>
      <title>How to join events with different fields name but same values ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-events-with-different-fields-name-but-same-values/m-p/440894#M125297</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have different sets of events that are linked together and correspond to the same process.&lt;/P&gt;

&lt;P&gt;Field1: One, Two, Three&lt;BR /&gt;
Field2: Four, Five, Six&lt;BR /&gt;
Field3: Seven, Eight, Nine&lt;/P&gt;

&lt;P&gt;FieldA: Four, Five, Six&lt;BR /&gt;
FieldB: Ten, Eleven, Twelve&lt;BR /&gt;
FieldC: First, Second, Third&lt;/P&gt;

&lt;P&gt;FieldX: Ten, Eleven, Twelve&lt;BR /&gt;
FieldY: ABC, DEF, GHI&lt;BR /&gt;
FieldZ: JKL, MNO, PQR&lt;/P&gt;

&lt;P&gt;Field2 and FieldA have the same values but different names.&lt;/P&gt;

&lt;P&gt;I want to display the following table: FieldB/X ; Field2/A ; Field1 ; Field3 ; FieldC ; FieldY ; Field Z&lt;/P&gt;

&lt;P&gt;I can join 2 sets together but I fail to correlate the third.&lt;BR /&gt;
Do you know how to do it?&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 13:11:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-events-with-different-fields-name-but-same-values/m-p/440894#M125297</guid>
      <dc:creator>lyds</dc:creator>
      <dc:date>2018-08-31T13:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to join events with different fields name but same values ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-events-with-different-fields-name-but-same-values/m-p/440895#M125298</link>
      <description>&lt;P&gt;You don't need a &lt;CODE&gt;join&lt;/CODE&gt; here.  Here's some pseudocode to do it with &lt;CODE&gt;stats&lt;/CODE&gt;...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(search for first event) OR (search for second event type) OR (search for third type)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;| fields ....list all the fields you want from any side &lt;BR /&gt;
   | eval matchkey=case(test/for/first/type, first key,&lt;BR /&gt;
        test/for/second/type, second key,&lt;BR /&gt;
        test/for/third/type, third key)&lt;BR /&gt;
   | stats values(*) as * by matchkey&lt;/P&gt;

&lt;P&gt;The last line could specify only the fields you really want...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats values(fieldA) as fieldA values(fieldB) as fieldB by matchkey
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or you can accept it the way it is and filter the fields afterwards with &lt;CODE&gt;| fields&lt;/CODE&gt; or &lt;CODE&gt;| table&lt;/CODE&gt;.&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;You can review the answer on this one for a more complete explanation of how and why to use the &lt;CODE&gt;stats&lt;/CODE&gt; method we just demonstrated.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/561130/how-to-join-two-tables-where-the-key-is-named-diff.html"&gt;https://answers.splunk.com/answers/561130/how-to-join-two-tables-where-the-key-is-named-diff.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 16:03:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-events-with-different-fields-name-but-same-values/m-p/440895#M125298</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-08-31T16:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to join events with different fields name but same values ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-events-with-different-fields-name-but-same-values/m-p/440896#M125299</link>
      <description>&lt;P&gt;HI &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/137167"&gt;@lyds&lt;/a&gt;&lt;/P&gt;

&lt;P&gt;Can you please below search?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;FIRST_RESULT_SET | append [ search SECOND_RESULT_SET | rename FieldA as Field2 ] | stats values(*) as * by Field2 | append [search THIRD_RESULT_SET  | rename FieldX as FieldB ] | stats values(*) as * by FieldB
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note: Replace your 3 searches with FIRST_RESULT_SET , SECOND_RESULT_SET  &amp;amp; THIRD_RESULT_SET.&lt;/P&gt;

&lt;P&gt;Below is my sample search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults  | eval Field1="One, Two, Three", Field2="Four, Five, Six",Field3="Seven, Eight, Nine",Field1=split(Field1,","),Field2=split(Field2,","),Field3=split(Field3,","),temp=mvzip(mvzip(Field1,Field2),Field3) | stats count by temp | eval Field1=mvindex(split(temp,","),0),Field2=mvindex(split(temp,","),1),Field3=mvindex(split(temp,","),2) | table Field1,Field2,Field3 | append [ | makeresults  | eval FieldA="Four, Five, Six", FieldB="Ten, Eleven, Twelve",FieldC="First, Second, Third",FieldA=split(FieldA,","),FieldB=split(FieldB,","),FieldC=split(FieldC,","),temp=mvzip(mvzip(FieldA,FieldB),FieldC) | stats count by temp | eval FieldA=mvindex(split(temp,","),0),FieldB=mvindex(split(temp,","),1),FieldC=mvindex(split(temp,","),2) | table FieldA,FieldB,FieldC | rename FieldA as Field2 ] | stats values(*) as * by Field2 | append [| makeresults  | eval FieldX="Ten, Eleven, Twelve", FieldY="ABC, DEF, GHI",FieldZ="JKL, MNO, PQR",FieldX=split(FieldX,","),FieldY=split(FieldY,","),FieldZ=split(FieldZ,","),temp=mvzip(mvzip(FieldX,FieldY),FieldZ) | stats count by temp | eval FieldX=mvindex(split(temp,","),0),FieldY=mvindex(split(temp,","),1),FieldZ=mvindex(split(temp,","),2) | table FieldX,FieldY,FieldZ | rename FieldX as FieldB ] | stats values(*) as * by FieldB
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Happy Splunking&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:06:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-events-with-different-fields-name-but-same-values/m-p/440896#M125299</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2020-09-29T21:06:08Z</dc:date>
    </item>
  </channel>
</rss>

