<?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 basic left join not working in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-basic-left-join-not-working/m-p/401160#M116167</link>
    <description>&lt;P&gt;Without sample events, both complete searches commands it is nearly impossible to tell.&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
    <pubDate>Wed, 04 Mar 2020 20:59:16 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2020-03-04T20:59:16Z</dc:date>
    <item>
      <title>Splunk basic left join not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-basic-left-join-not-working/m-p/401155#M116162</link>
      <description>&lt;P&gt;I am on Splunk 7.0.2 and trying to join two search strings with a common field but for reason this is not working.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="someindex" user="ABCD" | rename user as username | join type=left username [ search index="windows" | fields username, firstname, lastname] | table username, firstname, lastname
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is a sample of my search string which is very basic and its still not working.&lt;/P&gt;

&lt;P&gt;The main search returns 5 results when searched like &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index="someindex" user="ABCD"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;And the secondary search return 15 results when searched like &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index="windows" username="ABCD" | fields username, firstname, lastname&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jun 2018 02:14:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-basic-left-join-not-working/m-p/401155#M116162</guid>
      <dc:creator>karthikmalla</dc:creator>
      <dc:date>2018-06-22T02:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk basic left join not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-basic-left-join-not-working/m-p/401156#M116163</link>
      <description>&lt;P&gt;Hi karthikmalla,&lt;/P&gt;

&lt;P&gt;give this a try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="someindex" user="ABCD" OR index="windows"
| eval username=case(isnotnull(user), user, isnotnull(username), username, 1=1, "unknown") 
| fields username, firstname, lastname
| stats values(*) AS * by username
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;add a &lt;CODE&gt;table&lt;/CODE&gt; to sort it as needed.&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jun 2018 03:54:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-basic-left-join-not-working/m-p/401156#M116163</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2018-06-22T03:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk basic left join not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-basic-left-join-not-working/m-p/401157#M116164</link>
      <description>&lt;P&gt;The reason I am using Join is to pull list of users in main search and then look for those users in secondary search and the way you are proposing is pulling both main &amp;amp; secondary users list and then pick the ones that has both the values, this will put lot of stress to the server. Also in realty the fields are not just username, firstname and lastname. I just did put a sample, I want to join the searches based on the common field username so that I can grab all the fields from both the searches. Your answer won't help. Sorry. &lt;/P&gt;</description>
      <pubDate>Fri, 22 Jun 2018 05:22:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-basic-left-join-not-working/m-p/401157#M116164</guid>
      <dc:creator>karthikmalla</dc:creator>
      <dc:date>2018-06-22T05:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk basic left join not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-basic-left-join-not-working/m-p/401158#M116165</link>
      <description>&lt;P&gt;Okay, lets take a different approach here ... &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;join&lt;/CODE&gt; is not the join one knows in the DB world. &lt;CODE&gt;join&lt;/CODE&gt; is one of the most inefficient SPL commands, and has a lot of limitations, by using sub searches, that you can hit even without knowing you hit them &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Search/Aboutsubsearches#Subsearch_performance_considerations"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Search/Aboutsubsearches#Subsearch_performance_considerations&lt;/A&gt; &lt;BR /&gt;
On the other side &lt;CODE&gt;stats&lt;/CODE&gt; is one of the most efficient SPL commands you can use, more here &lt;A href="https://answers.splunk.com/answers/129424/how-to-compare-fields-over-multiple-sourcetypes-without-join-append-or-use-of-subsearches.html"&gt;https://answers.splunk.com/answers/129424/how-to-compare-fields-over-multiple-sourcetypes-without-join-append-or-use-of-subsearches.html&lt;/A&gt; or here &lt;A href="http://sideviewapps.com/slides/2017_05_02_sideview_let_stats_sort_them_out.pptx"&gt;http://sideviewapps.com/slides/2017_05_02_sideview_let_stats_sort_them_out.pptx&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;That said, if you combine two searches as base filter, and make them as specific as possible by using all metadata fields &lt;CODE&gt;index&lt;/CODE&gt;,&lt;CODE&gt;source&lt;/CODE&gt;,&lt;CODE&gt;sourcetype&lt;/CODE&gt;, and &lt;CODE&gt;host&lt;/CODE&gt; as well as all needed fields like &lt;CODE&gt;foo=*&lt;/CODE&gt; and/or &lt;CODE&gt;bar=*&lt;/CODE&gt; and add the &lt;CODE&gt;fields&lt;/CODE&gt; command &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Fields"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Fields&lt;/A&gt; after the first &lt;CODE&gt;|&lt;/CODE&gt; you will tell Splunk just to look for and return these fields. In addition using &lt;CODE&gt;stats&lt;/CODE&gt; you will make Splunk to use map reduce and parts of the search results are pre-processed on the indexers.&lt;/P&gt;

&lt;P&gt;Any search using sub searches will be most likely run twice as long (there are exception) and put more load on the servers. So by using a &lt;CODE&gt;join&lt;/CODE&gt; you actually do exactly what you mentioned as reason you don't want to use a &lt;CODE&gt;stats&lt;/CODE&gt; search &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Hope this makes more sense now, and give it a try and compare the run times of the join search and of the stats search ... I'm pretty confident you will no longer use &lt;CODE&gt;join&lt;/CODE&gt; after this comparison &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jun 2018 21:06:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-basic-left-join-not-working/m-p/401158#M116165</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2018-06-22T21:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk basic left join not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-basic-left-join-not-working/m-p/401159#M116166</link>
      <description>&lt;P&gt;Aside from the inefficiencies of using 'join', do you know why the original join did &lt;EM&gt;not&lt;/EM&gt; work? Is there anything wrong with its syntax? I am going through the same kind of problem with a different search and using a savedsearch in the subsearch (with only about 800 results in this savedsearch). &lt;BR /&gt;
Specifically, main search produces a table of results with the following fields: field1, field2, field3, field4, (uses stats + other streaming commands) while the savedsearch  produces another set of fields (field1, field5, field6, field7, etc.). My combined search statement is as follows:  my-main-search  | join field1 [savedsearch "mysavedsearch"]. Unfortunately the addition of the join does not change at all the result of the original query (without the join). Do you have any suggestions here? &lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 17:34:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-basic-left-join-not-working/m-p/401159#M116166</guid>
      <dc:creator>pgoldweic</dc:creator>
      <dc:date>2020-03-04T17:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk basic left join not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-basic-left-join-not-working/m-p/401160#M116167</link>
      <description>&lt;P&gt;Without sample events, both complete searches commands it is nearly impossible to tell.&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 20:59:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-basic-left-join-not-working/m-p/401160#M116167</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2020-03-04T20:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk basic left join not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-basic-left-join-not-working/m-p/690267#M235107</link>
      <description>&lt;P&gt;"join&lt;SPAN&gt;&amp;nbsp;is one of the most inefficient SPL commands, and has a lot of limitations, by using sub searches, that you can hit even without knowing you hit them"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Then deprecate its use.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2024 19:41:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-basic-left-join-not-working/m-p/690267#M235107</guid>
      <dc:creator>Justicex7</dc:creator>
      <dc:date>2024-06-10T19:41:56Z</dc:date>
    </item>
  </channel>
</rss>

