<?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: Left JOIN using two searches in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Left-JOIN-using-two-searches/m-p/350386#M103748</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Please try this below query.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=ad source=otl_addnsscan name=*nas* type=CNAME NOT ( name=*.options-it.com OR name=*app*) 
         | rex field=data "^(?&amp;lt;machine&amp;gt;[^.]+).*$" 
         | eval  machine = lower(machine) 
         | search NOT  machine=*app* 
         |eval name=lower(machine)
         | table  machine, Path
     | search NOT 
         [ search index=summary report=jira_serverrequests Component/s=*Momom* 
         | eval machine=lower('Server Name') 
         | table machine]
     |dedup  machine
     | sort  machine asc
| join type=left machine [ search index=windows host=*nas* source=WMI:Shares 
 |eval machine=lower(host)
 | dedup machine, Path, Caption | table machine, Path, Caption ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 20 Dec 2017 09:57:51 GMT</pubDate>
    <dc:creator>harsmarvania57</dc:creator>
    <dc:date>2017-12-20T09:57:51Z</dc:date>
    <item>
      <title>Left JOIN using two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Left-JOIN-using-two-searches/m-p/350385#M103747</link>
      <description>&lt;P&gt;I have these two searches below and I want to join the fieldname Path from the first query to the second query using the machine as the unique identifier.&lt;/P&gt;

&lt;P&gt;Search 1-  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=ad source=otl_addnsscan name=*nas* type=CNAME NOT ( name=*.opt.com OR name=*app*) 
        | rex field=data "^(?&amp;lt;machine&amp;gt;[^.]+).*$" 
        | eval  machine = lower(machine) 
        | search NOT  machine=*app* 
        |eval name=lower(machine)
        | table  machine, Path
    | search NOT 
        [ search index=summary report=jira_serverrequests Component/s=*Momom* 
        | eval machine=lower('Server Name') 
        | table machine]
    |dedup  machine
    | sort  machine asc
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Search 2 -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=windows host=*nas* source=WMI:Shares 
| rename host as name 
|eval name=lower(machine)
| dedup name, Path, Caption | table name, Path, Caption 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Dec 2017 09:51:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Left-JOIN-using-two-searches/m-p/350385#M103747</guid>
      <dc:creator>davidcraven02</dc:creator>
      <dc:date>2017-12-20T09:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Left JOIN using two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Left-JOIN-using-two-searches/m-p/350386#M103748</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Please try this below query.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=ad source=otl_addnsscan name=*nas* type=CNAME NOT ( name=*.options-it.com OR name=*app*) 
         | rex field=data "^(?&amp;lt;machine&amp;gt;[^.]+).*$" 
         | eval  machine = lower(machine) 
         | search NOT  machine=*app* 
         |eval name=lower(machine)
         | table  machine, Path
     | search NOT 
         [ search index=summary report=jira_serverrequests Component/s=*Momom* 
         | eval machine=lower('Server Name') 
         | table machine]
     |dedup  machine
     | sort  machine asc
| join type=left machine [ search index=windows host=*nas* source=WMI:Shares 
 |eval machine=lower(host)
 | dedup machine, Path, Caption | table machine, Path, Caption ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Dec 2017 09:57:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Left-JOIN-using-two-searches/m-p/350386#M103748</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2017-12-20T09:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: Left JOIN using two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Left-JOIN-using-two-searches/m-p/350387#M103749</link>
      <description>&lt;P&gt;Thank you this returns close to what I'm looking for.&lt;/P&gt;

&lt;P&gt;However most machines have multiple different paths for each but this is only returning one path per machine. Any thoughts?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2017 10:14:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Left-JOIN-using-two-searches/m-p/350387#M103749</guid>
      <dc:creator>davidcraven02</dc:creator>
      <dc:date>2017-12-20T10:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: Left JOIN using two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Left-JOIN-using-two-searches/m-p/350388#M103750</link>
      <description>&lt;P&gt;Will you please try this? I am assuming that you have multiple paths in 2nd query.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    index=ad source=otl_addnsscan name=*nas* type=CNAME NOT ( name=*.options-it.com OR name=*app*) 
              | rex field=data "^(?&amp;lt;machine&amp;gt;[^.]+).*$" 
              | eval  machine = lower(machine) 
              | search NOT  machine=*app* 
              |eval name=lower(machine)
              | table  machine, Path
          | search NOT 
              [ search index=summary report=jira_serverrequests Component/s=*Momom* 
              | eval machine=lower('Server Name') 
              | table machine]
          |dedup  machine
          | sort  machine asc
     | join type=left machine [ search index=windows host=*nas* source=WMI:Shares 
      |eval machine=lower(host)
      | dedup machine, Path, Caption 
      | stats values(Path) AS Path, values(Caption) AS Caption by machine
      | table machine, Path, Caption ]
     | mvexpand Path
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Dec 2017 10:20:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Left-JOIN-using-two-searches/m-p/350388#M103750</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2017-12-20T10:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: Left JOIN using two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Left-JOIN-using-two-searches/m-p/350389#M103751</link>
      <description>&lt;P&gt;Thank you very much this pulls back all paths in the one row!&lt;/P&gt;

&lt;P&gt;Sorry to be a pest but is there any way to have each new path as a new row in the table rather than contained in one line?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2017 10:23:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Left-JOIN-using-two-searches/m-p/350389#M103751</guid>
      <dc:creator>davidcraven02</dc:creator>
      <dc:date>2017-12-20T10:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Left JOIN using two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Left-JOIN-using-two-searches/m-p/350390#M103752</link>
      <description>&lt;P&gt;To expand each Path in new row, I have given &lt;CODE&gt;| mvexpand Path&lt;/CODE&gt; in last query. Didn't that worked ?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2017 10:31:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Left-JOIN-using-two-searches/m-p/350390#M103752</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2017-12-20T10:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Left JOIN using two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Left-JOIN-using-two-searches/m-p/350391#M103753</link>
      <description>&lt;P&gt;No unfortunately it didn't work, all paths are listed under Path and the same for Caption&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2017 10:35:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Left-JOIN-using-two-searches/m-p/350391#M103753</guid>
      <dc:creator>davidcraven02</dc:creator>
      <dc:date>2017-12-20T10:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: Left JOIN using two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Left-JOIN-using-two-searches/m-p/350392#M103754</link>
      <description>&lt;P&gt;Can you please try below query but this will give you multiple result for single host. For xample you have 2 path and 2 caption for single host then it will generate 4 row in table (1st Path with both Caption so 2 events and 2nd Path with both Caption so another 2 events).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=ad source=otl_addnsscan name=*nas* type=CNAME NOT ( name=*.options-it.com OR name=*app*) 
               | rex field=data "^(?&amp;lt;machine&amp;gt;[^.]+).*$" 
               | eval  machine = lower(machine) 
               | search NOT  machine=*app* 
               |eval name=lower(machine)
               | table  machine, Path
           | search NOT 
               [ search index=summary report=jira_serverrequests Component/s=*Momom* 
               | eval machine=lower('Server Name') 
               | table machine]
           |dedup  machine
           | sort  machine asc
| join type=left machine [ search index=windows host=*nas* source=WMI:Shares 
       |eval machine=lower(host)
       | dedup machine, Path, Caption 
       | stats values(Path) AS Path, values(Caption) AS Caption by machine
       | table machine, Path, Caption ]
| makemv delim=" " Path
| makemv delim=" " Caption
| mvexpand Path
| mvexpand Caption
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Dec 2017 10:51:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Left-JOIN-using-two-searches/m-p/350392#M103754</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2017-12-20T10:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: Left JOIN using two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Left-JOIN-using-two-searches/m-p/350393#M103755</link>
      <description>&lt;P&gt;Many thanks, I was able to use an append instead of a left join.&lt;/P&gt;

&lt;P&gt;I really appreciate your help!&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2017 12:47:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Left-JOIN-using-two-searches/m-p/350393#M103755</guid>
      <dc:creator>davidcraven02</dc:creator>
      <dc:date>2017-12-20T12:47:00Z</dc:date>
    </item>
  </channel>
</rss>

