<?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: how to turn an inner join into sub-search and pass non matching values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-turn-an-inner-join-into-sub-search-and-pass-non-matching/m-p/198539#M57407</link>
    <description>&lt;P&gt;I appreciate the blog link. A lot of good info there. the accumulated account list isn't practical in this case, as the list is massive and the search is taking only a small slice (and that slice changes based on daily assignments so the pull needs to be dynamic)&lt;BR /&gt;
The second suggestion doesn't account for the fact that Id = AccountId which is why I had to join...   I believe the 2nd suggestion is actually where I started... and the inner join is where I ended up. - hoping for more insight.&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jan 2014 16:59:55 GMT</pubDate>
    <dc:creator>rsennett_splunk</dc:creator>
    <dc:date>2014-01-09T16:59:55Z</dc:date>
    <item>
      <title>how to turn an inner join into sub-search and pass non matching values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-turn-an-inner-join-into-sub-search-and-pass-non-matching/m-p/198537#M57405</link>
      <description>&lt;P&gt;&lt;CODE&gt;sourcetype=Account &lt;/CODE&gt; contains Id values and the AccountName&lt;BR /&gt;&lt;BR /&gt;
&lt;CODE&gt;sourcetype=Issue&lt;/CODE&gt;  contains AccountId values but no AccountName and this is really the sourcetype that contains the stuff I want to report on...&lt;/P&gt;

&lt;P&gt;If I do an inner join:&lt;BR /&gt;&lt;BR /&gt;
Filter sourcetype Account then&lt;BR /&gt;
&lt;CODE&gt;&lt;BR /&gt;
| eval AccountId = Id &lt;BR /&gt;
| fields Name, AccountId&lt;BR /&gt;
| join type=inner AccountId [search sourcetype=Issue |fields AccountId Name Issue&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;B&gt;This search has completed and has returned 4 results by scanning 481 events in 49.392 seconds.&lt;/B&gt;&lt;/P&gt;

&lt;P&gt;If I use a sub-search&lt;BR /&gt;
&lt;CODE&gt;&lt;BR /&gt;
Sourcetype=Issue&lt;BR /&gt;
 [sourcetype=Account ...filter-the-AccountId...|fields + AccountId]&lt;BR /&gt;
 table AccountId Issue&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;B&gt;This search has completed and has returned 4 results by scanning 686 events in 6.182 seconds.&lt;/B&gt;&lt;/P&gt;

&lt;P&gt;What I want is&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt; table Name Issue&lt;/CODE&gt;...&lt;/P&gt;

&lt;P&gt;But I've tried a few things and I can't figure out how to pass the Account Name, or where I'd do a lookup for it so I could get the fields from the Account and the Issue together without doing the inner join... &lt;/P&gt;

&lt;P&gt;How would I structure this so it's more efficient than the inner join? I know there must be a better way...&lt;BR /&gt;
 Right now I'm keeping the timeframe small, but I'd like to expand both the filters on the Accounts and the timeframe.&lt;BR /&gt;
 If I have to use the inner join, I'm afraid I'm really just approaching this wrong.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2014 03:27:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-turn-an-inner-join-into-sub-search-and-pass-non-matching/m-p/198537#M57405</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2014-01-09T03:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: how to turn an inner join into sub-search and pass non matching values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-turn-an-inner-join-into-sub-search-and-pass-non-matching/m-p/198538#M57406</link>
      <description>&lt;P&gt;The "most splunkish" (splunkonic?  splunkadelic?) way of doing this is with an actual lookup file.  You would do a scheduled search of the form:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=Account 
| fields Id, Accountname 
| inputlookup append=t accounts.csv
| stats first(Accountname) as Accountname by Id
| outputlookup accounts.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This would (incrementally) maintain the lookup file in the fashion araitz demonstrates in &lt;A href="http://blogs.splunk.com/2011/01/11/maintaining-state-of-the-union/"&gt;hist blog post&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;Then your real search can use a simple &lt;CODE&gt;lookup&lt;/CODE&gt; command (or an implicitly defined lookup in the configuration files) to bring in the Accountname data.&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Another approach that might work is to use a "disjointed search" along with &lt;CODE&gt;stats&lt;/CODE&gt; as a row-compression function.  I've not tested this, but a search similar to:&lt;/P&gt;

&lt;P&gt;sourcetype=Account OR sourcetype=issue&lt;BR /&gt;
   | stats first(Name) as Name, first(Issue) as Issue by Id&lt;/P&gt;

&lt;P&gt;Should get fairly close to what you're trying to do.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2014 05:09:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-turn-an-inner-join-into-sub-search-and-pass-non-matching/m-p/198538#M57406</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2014-01-09T05:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to turn an inner join into sub-search and pass non matching values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-turn-an-inner-join-into-sub-search-and-pass-non-matching/m-p/198539#M57407</link>
      <description>&lt;P&gt;I appreciate the blog link. A lot of good info there. the accumulated account list isn't practical in this case, as the list is massive and the search is taking only a small slice (and that slice changes based on daily assignments so the pull needs to be dynamic)&lt;BR /&gt;
The second suggestion doesn't account for the fact that Id = AccountId which is why I had to join...   I believe the 2nd suggestion is actually where I started... and the inner join is where I ended up. - hoping for more insight.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2014 16:59:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-turn-an-inner-join-into-sub-search-and-pass-non-matching/m-p/198539#M57407</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2014-01-09T16:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: how to turn an inner join into sub-search and pass non matching values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-turn-an-inner-join-into-sub-search-and-pass-non-matching/m-p/198540#M57408</link>
      <description>&lt;P&gt;Isn't the naming deal solved with a simple &lt;CODE&gt;| eval Id=coalesce(Id,AccountId)&lt;/CODE&gt; or a &lt;CODE&gt;| rename AccountId AS ID&lt;/CODE&gt; ?&lt;/P&gt;

&lt;P&gt;Also, Splunk is designed to handle extremely large lookups fairly efficiently.  If your list of (Id, Accountname) tuples in &lt;CODE&gt;sourcetype=Account&lt;/CODE&gt; is &amp;lt; 1GB a lookup is still applicable.  &lt;/P&gt;

&lt;P&gt;I get a somewhat funny feeling that your &lt;CODE&gt;Account&lt;/CODE&gt; sourcetype is coming from a relational source of sorts anyway - so why not make a lookup file directly from there?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2014 19:04:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-turn-an-inner-join-into-sub-search-and-pass-non-matching/m-p/198540#M57408</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2014-01-09T19:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to turn an inner join into sub-search and pass non matching values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-turn-an-inner-join-into-sub-search-and-pass-non-matching/m-p/198541#M57409</link>
      <description>&lt;P&gt;Try the following (just in case creating lookup is not an option for you):-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=Account ...other filters...| stats count by Id, Accountname
| rename Id as AccountId | fields - count
| join AccountId [search sourcetype=Issue |fields AccountId Name Issue]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;if there could be more that one issue for an AccountId, then use "| join max=0" instead of "|join".&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2014 21:27:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-turn-an-inner-join-into-sub-search-and-pass-non-matching/m-p/198541#M57409</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-01-09T21:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to turn an inner join into sub-search and pass non matching values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-turn-an-inner-join-into-sub-search-and-pass-non-matching/m-p/198542#M57410</link>
      <description>&lt;P&gt;thank you... yes. the lookup is indeed an issue... and the join works fine, it's just not efficient. the join is where I started. (I did try different types of joins)&lt;/P&gt;

&lt;P&gt;That might just be where I have to be. I was hoping there was some way I was missing... where once I passed the Id/AccountId I would have a way to pass other fields as well even though they were cosmetic and had no match in the 2nd sourcetype.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2014 21:47:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-turn-an-inner-join-into-sub-search-and-pass-non-matching/m-p/198542#M57410</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2014-01-09T21:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: how to turn an inner join into sub-search and pass non matching values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-turn-an-inner-join-into-sub-search-and-pass-non-matching/m-p/198543#M57411</link>
      <description>&lt;P&gt;correct. these are extracts from relational tables... which is why this is a bit of a mess... as for renaming... yes, it would be. I was following your suggestion exactly which left out the eval. maybe I'm missing the insight you're trying to pass along... it's actually the coalesce I hadn't thought of... which might now turn out to be a help. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2014 21:50:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-turn-an-inner-join-into-sub-search-and-pass-non-matching/m-p/198543#M57411</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2014-01-09T21:50:35Z</dc:date>
    </item>
  </channel>
</rss>

