<?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: Splunk Join Command not working as expected in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Join-Command-not-working-as-expected/m-p/493643#M137668</link>
    <description>&lt;P&gt;Hi @punyanit,&lt;BR /&gt;
only one question: if you run the second search (the subsearch) separately, how many results do you have?&lt;BR /&gt;
because there's the limit of 50,000 results in subsearches, so, maybe this is your problem.&lt;BR /&gt;
For this reson you should try to use a different approach (stats command) instead join that's in addition a very slow command.&lt;BR /&gt;
Something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=prod source=A) OR (index=preprod source=B)
| eval PROD=coalesce(PROD,CAP), TABLENAME_PROD=coalesce(TABLENAME_PROD,TABLENAME_CAP),  Partition_Column_PROD=coalesce(Partition_Column_PROD,Partition_Column_CAP), INI_TRANS_PROD=coalesce(INI_TRANS_PROD,INI_TRANS_CAP)
| stats count by PROD TABLENAME_PROD Partition_Column_PROD INI_TRANS_PROD Table Column Trans
| sort TABLENAME_PROD
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Tue, 12 May 2020 06:42:22 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2020-05-12T06:42:22Z</dc:date>
    <item>
      <title>Splunk Join Command not working as expected</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Join-Command-not-working-as-expected/m-p/493641#M137666</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;

&lt;P&gt;I am trying to join  using "Table" as common field, here is my query.&lt;/P&gt;

&lt;P&gt;index=prod  source=A &lt;BR /&gt;
| stats count by PROD TABLENAME_PROD Partition_Column_PROD INI_TRANS_PROD Table Column Trans &lt;BR /&gt;
| sort TABLENAME_PROD&lt;BR /&gt;
| join type=left Table &lt;BR /&gt;
    [ search index=preprod  source=B &lt;BR /&gt;
    | stats count by CAP TABLENAME_CAP Partition_Column_CAP INI_TRANS_CAP Table Column Trans&lt;BR /&gt;
    |sort TABLENAME_CAP&lt;BR /&gt;
     ] &lt;BR /&gt;
| table Partition_Column_PROD Partition_Column_CAP&lt;/P&gt;

&lt;P&gt;The values that i am getting here is not matching to those if i run both commands separately and join there output manually(keeping Table as common field)&lt;/P&gt;

&lt;P&gt;I.e values of  Partition_Column_CAP,Partition_Column_PROD , of this query should match with values of Partition_Column_CAP , Partition_Column_PROD which i will get if i would run these queries separately .&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;original Output of above query&lt;/STRONG&gt;&lt;BR /&gt;
Partition_Column_PROD               Partition_Column_CAP&lt;BR /&gt;
(ACS_ID, ACS_ID)                                        (ACS_ID)&lt;BR /&gt;
(ADDR_ID, ADDR_ID)                               (ADDR_ID)&lt;BR /&gt;
(CITY, CITY, ADDR_ID, ADDR_ID)             (ADDR_ID)&lt;BR /&gt;
(ALFRESCO_MSTR_REC_ID)                      (ALFRESCO_MSTR_REC_ID)&lt;BR /&gt;
(APPL_ID, APPL_ID)                               (APPL_ID)&lt;BR /&gt;
(ACS_METHD_ID, ACS_METHD_ID)         (ACS_METHD_ID)&lt;BR /&gt;
(APPL_CMPNT_ID, APPL_CMPNT_ID)  (APPL_CMPNT_ID)&lt;BR /&gt;
(CMPNT_TYP_ID, CMPNT_TYP_ID)          (APPL_CMPNT_ID)&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Expected output&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Partition_Column_PROD Partition_Column_CAP&lt;/STRONG&gt;&lt;BR /&gt;
(ACS_ID, ACS_ID)                                    (ACS_ID)&lt;BR /&gt;
(ADDR_ID, ADDR_ID)                          (ADDR_ID)&lt;BR /&gt;
(CITY, CITY, ADDR_ID, ADDR_ID)  (CITY, ADDR_ID)&lt;BR /&gt;
(ALFRESCO_MSTR_REC_ID)          (ALFRESCO_MSTR_REC_ID)&lt;BR /&gt;
(APPL_ID, APPL_ID)                         (APPL_ID)&lt;BR /&gt;
(ACS_METHD_ID, ACS_METHD_ID)    (ACS_METHD_ID)&lt;BR /&gt;
(APPL_CMPNT_ID, APPL_CMPNT_ID)  (APPL_CMPNT_ID)&lt;BR /&gt;
(CMPNT_TYP_ID, CMPNT_TYP_ID)    (CMPNT_TYP_ID)&lt;/P&gt;

&lt;P&gt;In above results Partition_Column_PROD and Partition_Column_CAP are from both searches(search and sub search) which is joined manually.&lt;/P&gt;

&lt;P&gt;There are no repetitive values for the second part of search query ,for ex the field Partition_Column_CAP has these 3 different values&lt;BR /&gt;
 (ACS_ID) , (ADDR_ID) ,(CITY, ADDR_ID) and each event has unique value&lt;/P&gt;

&lt;P&gt;now when i add this second part of search query to the join command i start seeing repetitive values for the same mentioned&lt;BR /&gt;
field mentioned above, which should not be the case&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:21:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Join-Command-not-working-as-expected/m-p/493641#M137666</guid>
      <dc:creator>punyanit</dc:creator>
      <dc:date>2020-09-30T05:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Join Command not working as expected</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Join-Command-not-working-as-expected/m-p/493642#M137667</link>
      <description>&lt;P&gt;what's the difference.&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 21:38:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Join-Command-not-working-as-expected/m-p/493642#M137667</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-11T21:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Join Command not working as expected</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Join-Command-not-working-as-expected/m-p/493643#M137668</link>
      <description>&lt;P&gt;Hi @punyanit,&lt;BR /&gt;
only one question: if you run the second search (the subsearch) separately, how many results do you have?&lt;BR /&gt;
because there's the limit of 50,000 results in subsearches, so, maybe this is your problem.&lt;BR /&gt;
For this reson you should try to use a different approach (stats command) instead join that's in addition a very slow command.&lt;BR /&gt;
Something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=prod source=A) OR (index=preprod source=B)
| eval PROD=coalesce(PROD,CAP), TABLENAME_PROD=coalesce(TABLENAME_PROD,TABLENAME_CAP),  Partition_Column_PROD=coalesce(Partition_Column_PROD,Partition_Column_CAP), INI_TRANS_PROD=coalesce(INI_TRANS_PROD,INI_TRANS_CAP)
| stats count by PROD TABLENAME_PROD Partition_Column_PROD INI_TRANS_PROD Table Column Trans
| sort TABLENAME_PROD
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 06:42:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Join-Command-not-working-as-expected/m-p/493643#M137668</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-05-12T06:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Join Command not working as expected</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Join-Command-not-working-as-expected/m-p/493644#M137669</link>
      <description>&lt;P&gt;@gcusello  thank you for effort, my subsearch is returning only 315 results in last 24hrs&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 08:36:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Join-Command-not-working-as-expected/m-p/493644#M137669</guid>
      <dc:creator>punyanit</dc:creator>
      <dc:date>2020-05-12T08:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Join Command not working as expected</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Join-Command-not-working-as-expected/m-p/493645#M137670</link>
      <description>&lt;P&gt;@to4kawa i have that in my question now&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 10:57:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Join-Command-not-working-as-expected/m-p/493645#M137670</guid>
      <dc:creator>punyanit</dc:creator>
      <dc:date>2020-05-13T10:57:02Z</dc:date>
    </item>
  </channel>
</rss>

