<?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: Issues in creating the join in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444617#M126115</link>
    <description>&lt;P&gt;The problem was not with the join but with the &lt;STRONG&gt;Table A&lt;/STRONG&gt; which was coming as the output of single event that's why the join was not successful. To split  the entries row wise, i have to apply the query as given below. &lt;/P&gt;

&lt;P&gt;&lt;EM&gt;index="index1" host="host1" source="source1" sourcetype="json" &lt;BR /&gt;
| head 1 &lt;BR /&gt;
| table data.users{}.number, data.users{}.email&lt;BR /&gt;
| rename data.users{}.number as number, data.users{}.email as "Email"&lt;BR /&gt;
*&lt;/EM&gt;| eval temp=mvzip(number,Email,"#") &lt;BR /&gt;
| mvexpand temp &lt;BR /&gt;
| makemv delim="#" temp &lt;BR /&gt;
| eval number = mvindex ( temp, 0) &lt;BR /&gt;
| eval Email = mvindex ( temp, 1) &lt;BR /&gt;
| fields - temp** &lt;BR /&gt;
| join number&lt;BR /&gt;
type=outer &lt;BR /&gt;
[ search index="index2" host="host2" source="source2" sourcetype="csv" "somekeyword" &lt;BR /&gt;
| table name, number1&lt;BR /&gt;
| rename number1 as number ] &lt;BR /&gt;
| table number, email, name*&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jul 2019 03:44:07 GMT</pubDate>
    <dc:creator>aayushisplunk1</dc:creator>
    <dc:date>2019-07-09T03:44:07Z</dc:date>
    <item>
      <title>Issues in creating the join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444606#M126104</link>
      <description>&lt;P&gt;Hello, &lt;BR /&gt;
I am facing issues joining the two table A &amp;amp; B given below: &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Table A:&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;A | email@xxx&lt;BR /&gt;
1 | abcd@xxxx&lt;BR /&gt;
2 | efgh@xxxx&lt;BR /&gt;
3 | xyza@xxxx&lt;BR /&gt;
4 | mno@xxxx&lt;BR /&gt;
5 | pqrs@xxxx&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Table B:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;B | name&lt;BR /&gt;
3 | ijk&lt;BR /&gt;
5 | lmn&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Required output table: Table C:&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;B | email@xxx | name&lt;BR /&gt;
3 | xyza@xxxx    | ijk&lt;BR /&gt;
5 | pqrs@xxxx    | lmn&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;My query:&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;&lt;EM&gt;mysearch&lt;BR /&gt;
| table A, email@xxxx &lt;BR /&gt;
| join &lt;BR /&gt;
    [ search mysearch2 &lt;BR /&gt;
    | table B, name] &lt;BR /&gt;
| table B, email@xxx, name | where B=A&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Is this the correct way to implement it ? if not, then please help me out with it .&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 10:31:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444606#M126104</guid>
      <dc:creator>aayushisplunk1</dc:creator>
      <dc:date>2019-06-28T10:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in creating the join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444607#M126105</link>
      <description>&lt;P&gt;First, the two tables need names for their fields.  For Table A I'll call them 'number' and 'email'; for Table B I'll call them 'number' and 'name'.  Using these names, here is a sample query using &lt;CODE&gt;join&lt;/CODE&gt;.  Notice the &lt;CODE&gt;where&lt;/CODE&gt; clause is absent.  That's because &lt;CODE&gt;join&lt;/CODE&gt; does it implicitly.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mysearch
| fields number, email
| join number [ search mysearch2 | fields number, name] 
| table number, email, name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The &lt;CODE&gt;join&lt;/CODE&gt; command is very inefficient.  If you share mysearch and mysearch2 we may be able to help create a search that combines them without using &lt;CODE&gt;join&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 12:42:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444607#M126105</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-06-28T12:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in creating the join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444608#M126106</link>
      <description>&lt;P&gt;@aayushisplunk1,&lt;/P&gt;

&lt;P&gt;Try using &lt;CODE&gt;stats&lt;/CODE&gt; instead of join &lt;/P&gt;

&lt;P&gt;Assuming that mysearch is index="index1" and mysearch2 is index="index2"&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index="index1" OR index="index2") | eval common_field=if (index=="index1",A,B)
|stats values(email) as email, values(name)  as name by common_field
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If it's not working for you , please share the search terms you are currently using.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 12:49:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444608#M126106</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-06-28T12:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in creating the join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444609#M126107</link>
      <description>&lt;P&gt;Thank you for the quick response!&lt;/P&gt;

&lt;P&gt;I tried your resolution but it didn't work for me. &lt;/P&gt;

&lt;P&gt;Please have a look at the exact query: &lt;/P&gt;

&lt;P&gt;index="index1" host="host1" source="source1" sourcetype="json" &lt;BR /&gt;
| head 1 &lt;BR /&gt;
| spath output=object path=data.users{} &lt;BR /&gt;
| foreach object &lt;BR /&gt;
    [ spath output=number path=data.users{}.number&lt;BR /&gt;
    | spath output=email path=data.users{}.email] &lt;BR /&gt;
| table number, email &lt;BR /&gt;
| join number&lt;BR /&gt;
    type=outer &lt;BR /&gt;
    [ search index="index2" host="host2" source="source2" sourcetype="csv"  "somekeyword" &lt;BR /&gt;
    | table  name, number1&lt;BR /&gt;
    | rename number1 as number ] &lt;BR /&gt;
| table number, email, name&lt;/P&gt;

&lt;P&gt;Here i have tried using outer join also. Please let me know the possible resolution.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 15:12:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444609#M126107</guid>
      <dc:creator>aayushisplunk1</dc:creator>
      <dc:date>2019-06-28T15:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in creating the join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444610#M126108</link>
      <description>&lt;P&gt;Thank you for the quick response!&lt;/P&gt;

&lt;P&gt;mysearch &amp;amp; mysearch2 are detailed out below: &lt;/P&gt;

&lt;P&gt;&lt;EM&gt;index="index1" host="host1" source="source1" sourcetype="json" &lt;BR /&gt;
| head 1 &lt;BR /&gt;
| spath output=object path=data.users{} &lt;BR /&gt;
| foreach object &lt;BR /&gt;
[ spath output=number path=data.users{}.number&lt;BR /&gt;
| spath output=email path=data.users{}.email] &lt;BR /&gt;
| table number, email &lt;BR /&gt;
| join number&lt;BR /&gt;
type=outer &lt;BR /&gt;
[ search index="index2" host="host2" source="source2" sourcetype="csv" "somekeyword" &lt;BR /&gt;
| table name, number1&lt;BR /&gt;
| rename number1 as number ] &lt;BR /&gt;
| table number, email, name&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Please let me know the possible resolution.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 15:16:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444610#M126108</guid>
      <dc:creator>aayushisplunk1</dc:creator>
      <dc:date>2019-06-28T15:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in creating the join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444611#M126109</link>
      <description>&lt;P&gt;You forgot to put the table headers (field names) for your Table A &amp;amp; Table B.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 15:19:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444611#M126109</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2019-06-28T15:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in creating the join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444612#M126110</link>
      <description>&lt;P&gt;Have you verified the two parts of the &lt;CODE&gt;join&lt;/CODE&gt; work as expected?&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jun 2019 12:40:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444612#M126110</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-06-29T12:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in creating the join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444613#M126111</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults
| eval raw="A=1,email=abcd@xxxx A=2,email=efgh@xxxx A=3,email=xyza@xxxx A=4,email=mno@xxxx A=5,email=pqrs@xxxx B=3,name=ijk B=5,name=lmn"
| makemv raw
| mvexpand raw
| rename raw AS _raw
| kv

| rename COMMENT AS "Everything above generates sample event data; everything below is your solution"

| eval B = coalesce(B, A)
| table  B email name
| stats list(*) AS * BY B
| where isnotnull(name)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Jul 2019 23:00:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444613#M126111</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-07-05T23:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in creating the join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444614#M126112</link>
      <description>&lt;P&gt;Hello richgalloway,&lt;/P&gt;

&lt;P&gt;Yes, the two parts of the join are working as expected. &lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 04:53:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444614#M126112</guid>
      <dc:creator>aayushisplunk1</dc:creator>
      <dc:date>2019-07-08T04:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in creating the join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444615#M126113</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;Thank you for responding !&lt;/P&gt;

&lt;P&gt;Since my input is in tabular format, i am not sure if i can use this. &lt;BR /&gt;
If i wish to use this procedure then how will i convert my tabular data to the format given below :&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;" eval raw="A=1,email=abcd@xxxx A=2,email=efgh@xxxx A=3,email=xyza@xxxx A=4,email=mno@xxxx A=5,email=pqrs@xxxx B=3,name=ijk B=5,name=lmn""&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 05:12:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444615#M126113</guid>
      <dc:creator>aayushisplunk1</dc:creator>
      <dc:date>2019-07-08T05:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in creating the join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444616#M126114</link>
      <description>&lt;P&gt;No, no, no.  Just use lines 10-13 of my answer after your &lt;CODE&gt;((index=iA AND sourcetype=sA) OR (index=iB AND sourcetype=sB))&lt;/CODE&gt; line.  The other stuff is just what I used to test.  Read the &lt;CODE&gt;COMMENT AS&lt;/CODE&gt; stuff.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 14:36:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444616#M126114</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-07-08T14:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in creating the join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444617#M126115</link>
      <description>&lt;P&gt;The problem was not with the join but with the &lt;STRONG&gt;Table A&lt;/STRONG&gt; which was coming as the output of single event that's why the join was not successful. To split  the entries row wise, i have to apply the query as given below. &lt;/P&gt;

&lt;P&gt;&lt;EM&gt;index="index1" host="host1" source="source1" sourcetype="json" &lt;BR /&gt;
| head 1 &lt;BR /&gt;
| table data.users{}.number, data.users{}.email&lt;BR /&gt;
| rename data.users{}.number as number, data.users{}.email as "Email"&lt;BR /&gt;
*&lt;/EM&gt;| eval temp=mvzip(number,Email,"#") &lt;BR /&gt;
| mvexpand temp &lt;BR /&gt;
| makemv delim="#" temp &lt;BR /&gt;
| eval number = mvindex ( temp, 0) &lt;BR /&gt;
| eval Email = mvindex ( temp, 1) &lt;BR /&gt;
| fields - temp** &lt;BR /&gt;
| join number&lt;BR /&gt;
type=outer &lt;BR /&gt;
[ search index="index2" host="host2" source="source2" sourcetype="csv" "somekeyword" &lt;BR /&gt;
| table name, number1&lt;BR /&gt;
| rename number1 as number ] &lt;BR /&gt;
| table number, email, name*&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2019 03:44:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444617#M126115</guid>
      <dc:creator>aayushisplunk1</dc:creator>
      <dc:date>2019-07-09T03:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: Issues in creating the join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444618#M126116</link>
      <description>&lt;P&gt;@aayushisplunk1 If your problem is resolved, please accept an answer to help future readers.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2019 12:07:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issues-in-creating-the-join/m-p/444618#M126116</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-07-09T12:07:24Z</dc:date>
    </item>
  </channel>
</rss>

