<?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 do I join these two searches? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196472#M56695</link>
    <description>&lt;P&gt;First, use &lt;CODE&gt;OR&lt;/CODE&gt; to get both:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(auditSource=auth auditType=LoginEntitlements detail.Ref=*) OR (auditSource="ei-microservice" detail.StatusCode="*" )
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Secondly, use eval's &lt;CODE&gt;coalesce()&lt;/CODE&gt; to push the two into a new field:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval REF = coalesce(detail.ERef, detail.Ref)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thirdly, perform the glorious stats &lt;CODE&gt;count&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count by REF
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Does that do what you're looking for ?&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Edit: To answer your question, when to use &lt;CODE&gt;join&lt;/CODE&gt;:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/611iE5C42311E3ABED09/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Aug 2015 09:18:59 GMT</pubDate>
    <dc:creator>aljohnson_splun</dc:creator>
    <dc:date>2015-08-28T09:18:59Z</dc:date>
    <item>
      <title>How do I join these two searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196471#M56694</link>
      <description>&lt;P&gt;Hi, I wonder whether someone may be able to help me please.&lt;/P&gt;

&lt;P&gt;I'm using the following searches:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Search 1 -  "EI Auth"&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Auth - index="main" auditSource=*auth* auditType=LoginEntitlements detail.Ref=* 
| stats count by detail.Ref 
| rename detail.Ref AS REF
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;*&lt;EM&gt;Search 2 - "EI Microservice" *&lt;/EM&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;MicroService - auditSource="ei-microservice" detail.StatusCode="*" 
| stats count by detail.ERef 
| rename detail.ERef AS REF
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I'm trying to do is join the two using the field REF, but despite looking at the tutorial on the Splunk documentation and receiving help &lt;A href="http://answers.splunk.com/answers/301591/unable-to-put-together-join-search.html"&gt;here&lt;/A&gt; I've still been unable the join the two.&lt;/P&gt;

&lt;P&gt;Could someone perhaps show me please how I can join the two searches, and could you also confirm for me please whether I have to run the two searches separately before running the 'Join' search?&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2015 08:00:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196471#M56694</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2015-08-28T08:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do I join these two searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196472#M56695</link>
      <description>&lt;P&gt;First, use &lt;CODE&gt;OR&lt;/CODE&gt; to get both:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(auditSource=auth auditType=LoginEntitlements detail.Ref=*) OR (auditSource="ei-microservice" detail.StatusCode="*" )
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Secondly, use eval's &lt;CODE&gt;coalesce()&lt;/CODE&gt; to push the two into a new field:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval REF = coalesce(detail.ERef, detail.Ref)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thirdly, perform the glorious stats &lt;CODE&gt;count&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count by REF
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Does that do what you're looking for ?&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Edit: To answer your question, when to use &lt;CODE&gt;join&lt;/CODE&gt;:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/611iE5C42311E3ABED09/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2015 09:18:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196472#M56695</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-08-28T09:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do I join these two searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196473#M56696</link>
      <description>&lt;P&gt;Hi @aljohnson many thanks for taking the time to come back to me with this, I've tested the solution and unfortunately this doesn't return any statistics although it does return events.&lt;/P&gt;

&lt;P&gt;Could you also possibly explain to me please in what situation would you use a join query?&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2015 09:27:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196473#M56696</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2015-08-28T09:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I join these two searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196474#M56697</link>
      <description>&lt;P&gt;I know for sure that this should world - it should return statistics... &lt;BR /&gt;
What you're asking to do is very easy - searching over two sourcetypes to count two fields.&lt;BR /&gt;
Are you sure there isn't anything you're leaving out of your examples ?&lt;/P&gt;

&lt;P&gt;I've updated my question to include a flowchart.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2015 10:08:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196474#M56697</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-08-28T10:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I join these two searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196475#M56698</link>
      <description>&lt;P&gt;Hi @aljohnson,  I've had problems with Splunk this morning, and I think that this was the cause of the problems  because the query is now showing no results found.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris &lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2015 11:01:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196475#M56698</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2015-08-28T11:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I join these two searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196476#M56699</link>
      <description>&lt;P&gt;Sounds frustrating. If you need help on this query once you've resolved your other issues, you can @ mention me here again &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2015 11:10:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196476#M56699</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-08-28T11:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I join these two searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196477#M56700</link>
      <description>&lt;P&gt;That's great, I really appreciate it.&lt;/P&gt;

&lt;P&gt;Kind Regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2015 11:17:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196477#M56700</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2015-08-28T11:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do I join these two searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196478#M56701</link>
      <description>&lt;P&gt;Is this flowchart PNG a creation by @aljohnson or someone else?  Is there a broader context (maybe other great flowcharts) that I can see online? &lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2015 14:31:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196478#M56701</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-28T14:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I join these two searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196479#M56702</link>
      <description>&lt;P&gt;@woodcock the flowchart is from the docs, &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.5/Search/Abouteventcorrelation"&gt;here&lt;/A&gt;, and the information within in it provided by @sideview (Nick Mealy) &lt;/P&gt;</description>
      <pubDate>Sat, 29 Aug 2015 08:22:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196479#M56702</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-08-29T08:22:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do I join these two searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196480#M56703</link>
      <description>&lt;P&gt;o/   It's true the flowchart was included in the docs based on a nearly identical flowchart that I made years ago.  Needs some updating probably.  Maybe even an expansion of scope beyond just row aggregation.   It comes in most handy when you try to explain to relatively new splunkers why they really shouldn't use join or append.  Somewhat early on join clicks with new users, particularly those with SQL experience and they think of it as a primary tool.  It is not.  It is an edge case tool, where stats and eval are the primary tools.     Short Version:   If you think you need to use join,  go find this flow chart and it'll probably tell you there's a better way. &lt;/P&gt;</description>
      <pubDate>Sat, 29 Aug 2015 16:41:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-these-two-searches/m-p/196480#M56703</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2015-08-29T16:41:25Z</dc:date>
    </item>
  </channel>
</rss>

