<?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: Is there an alternate to join? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433062#M123711</link>
    <description>&lt;P&gt;This worked like a charm! I cant thank you enough &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Aug 2018 15:49:15 GMT</pubDate>
    <dc:creator>djain</dc:creator>
    <dc:date>2018-08-30T15:49:15Z</dc:date>
    <item>
      <title>Is there an alternate to join?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433054#M123703</link>
      <description>&lt;P&gt;I am trying to create a join with a subsearch, but the subsearch results are getting truncated. is there a better way than join?&lt;/P&gt;

&lt;P&gt;Example query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=XXX sourcetype=XXX1 host=*prod* http_method=POST 
| join type=left Trace 
[ search index=YYY sourcetype=YYY1 env=prod  response="123"  | rex field=moneyTrace "222=(?.*);parent.*"  | where isnull(status) ] 
| chart count(Trace) by http_status 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here http_status and Trace are fields in the first query&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 16:07:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433054#M123703</guid>
      <dc:creator>djain</dc:creator>
      <dc:date>2018-08-28T16:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternate to join?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433055#M123704</link>
      <description>&lt;P&gt;@djain, while posting code/sample data use the &lt;CODE&gt;code&lt;/CODE&gt; button i.e. &lt;CODE&gt;10101&lt;/CODE&gt; or shortcut key &lt;CODE&gt;Ctrl+K&lt;/CODE&gt; after selecting the code/sample data, so that special characters do not escape.&lt;/P&gt;

&lt;P&gt;You try &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Multisearch"&gt;multisearch&lt;/A&gt; or else base search with two sourcetypes i.e.&lt;CODE&gt;XXX1&lt;/CODE&gt; and &lt;CODE&gt;YYY1&lt;/CODE&gt; and then stats &lt;CODE&gt;by Trace&lt;/CODE&gt; field.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 16:50:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433055#M123704</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-08-28T16:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternate to join?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433056#M123705</link>
      <description>&lt;P&gt;What value/field are you using from your 2nd/subsearch? Are you just looking to get count for Trace which appears in both sourcetypes?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 19:28:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433056#M123705</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-08-28T19:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternate to join?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433057#M123706</link>
      <description>&lt;P&gt;I am actually trying to compare 2 tables just like in sql. Both have Trace field and I want to see The one that exist in first search and the ones that are common in the second one. like a left join. http_status comes from subsearch and is not available in the primary search.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 13:49:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433057#M123706</guid>
      <dc:creator>djain</dc:creator>
      <dc:date>2018-08-29T13:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternate to join?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433058#M123707</link>
      <description>&lt;P&gt;Try something like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;( index="XXX" sourcetype=XXX1 host=*prod* http_method=POST)
OR
(index="YYY" sourcetype=YYY1 env=prod  response="123")
 | fields index moneyTrace status http_status  
 | rex field=moneyTrace "222=(?&amp;lt;Trace&amp;gt;.*);parent.*"  
 | where index="XXX" OR (index="YYY" AND isnull(status)) 
 | stats values(index) as index values(http_status) as http_status by Trace
 | where index="XXX" 
 | chart dc(Trace) by http_status 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please fix the &lt;CODE&gt;rex&lt;/CODE&gt; to have whatever was missing, if it is not &lt;CODE&gt;&amp;lt;Trace&amp;gt;&lt;/CODE&gt;.&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Updated to retain index names and only keep records that had at least one record in index "XXX"&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 14:26:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433058#M123707</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-08-29T14:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternate to join?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433059#M123708</link>
      <description>&lt;P&gt;Wouldn't this work as a inner join instead of a left join?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 14:33:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433059#M123708</guid>
      <dc:creator>djain</dc:creator>
      <dc:date>2018-08-29T14:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternate to join?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433060#M123709</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=XXX sourcetype=XXX1 host=*prod* http_method=POST ) OR (index=YYY sourcetype=YYY1 env=prod  response="123" NOT status=*)
| fields Trace moneyTrace http_status status
| rex field=moneyTrace "222=(?&amp;lt;Trace&amp;gt;.*);parent.*"  
 | stats values(sourcetype) as sourcetypes count(Trace) by http_status 
| where NOT (mvcount(sourcetypes)=1 AND sourcetype="YYY1")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Last where clause will exclude stuffs that are only on original subsearch.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 16:13:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433060#M123709</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-08-29T16:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternate to join?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433061#M123710</link>
      <description>&lt;P&gt;@djain - updated to retain the index info through the first stats and retain only the records that had a Trace in the index XXX.  This will simulate your left-join.&lt;/P&gt;

&lt;P&gt;Technically, &lt;CODE&gt;stats&lt;/CODE&gt; is an outer join, and would retain anything that had a &lt;CODE&gt;Trace&lt;/CODE&gt; in either index.  You use tricks like this to filter either the index name (for a left join) or &lt;CODE&gt;dc(index)&lt;/CODE&gt; for an inner join. &lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 02:15:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433061#M123710</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-08-30T02:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternate to join?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433062#M123711</link>
      <description>&lt;P&gt;This worked like a charm! I cant thank you enough &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 15:49:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433062#M123711</guid>
      <dc:creator>djain</dc:creator>
      <dc:date>2018-08-30T15:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternate to join?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433063#M123712</link>
      <description>&lt;P&gt;This some how kept giving me results from both sourcetypes. But thank you for the response! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 15:50:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-an-alternate-to-join/m-p/433063#M123712</guid>
      <dc:creator>djain</dc:creator>
      <dc:date>2018-08-30T15:50:01Z</dc:date>
    </item>
  </channel>
</rss>

