<?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: help on join command please in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/help-on-join-command-please/m-p/405591#M117248</link>
    <description>&lt;P&gt;Your stats is reducing the result of first row to just have single row with count and it has nothing to join with. In fact, for your requirement, you probably don't need join. Give this version a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=* sourcetype=* ) OR (eventtype=OSBuild)
|eval OS=if(........),        Build=if(...........) 
 | stats latest(OS) as OS latest(Build) as Build by host
 | stats count as Total by OS Build
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR this (would perform better)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count WHERE index=* sourcetype=* by host 
| append [venttype=OSBuild 
     | eval OS=if(........)
         Build=if(...........) 
     | stats latest(OS) as OS latest(Build) as Build by host]
| stats values(OS) as OS values(Build) as Build by host 
| stats count as Total by OS Build
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 22 Feb 2019 14:50:36 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2019-02-22T14:50:36Z</dc:date>
    <item>
      <title>help on join command please</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-join-command-please/m-p/405589#M117246</link>
      <description>&lt;P&gt;hi&lt;/P&gt;

&lt;P&gt;I use the search below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index =* sourcetype=*
| dedup host 
| stats count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This search returns 87 events&lt;BR /&gt;
I try to combine this results with another search in order to match the events of the first search with the events of the second search&lt;BR /&gt;
So I have to have also 87 events but it doesnt works&lt;BR /&gt;
could you help me please?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* sourcetype=* 
| dedup host 
| stats count 
| join type="outer" 
    [ search eventtype=OSBuild 
    | eval OS=if(........)
        Build=if(...........) 
    | stats latest(OS) as OS latest(Build) as Build by host] 
| stats values(OS) as OS values(Build) as Build by host 
| stats count as Total by OS Build
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Feb 2019 12:04:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-join-command-please/m-p/405589#M117246</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2019-02-22T12:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: help on join command please</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-join-command-please/m-p/405590#M117247</link>
      <description>&lt;P&gt;did you try using host in the main search?&lt;/P&gt;

&lt;P&gt;index=* sourcetype=*&lt;BR /&gt;&lt;BR /&gt;
 | stats count by host&lt;BR /&gt;
 | join type="outer" &lt;BR /&gt;
     [ search eventtype=OSBuild &lt;BR /&gt;
     | eval OS=if(........)&lt;BR /&gt;
         Build=if(...........) &lt;BR /&gt;
     | stats latest(OS) as OS latest(Build) as Build by host] &lt;BR /&gt;
 | stats values(OS) as OS values(Build) as Build by host &lt;BR /&gt;
 | stats count as Total by OS Build&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 12:55:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-join-command-please/m-p/405590#M117247</guid>
      <dc:creator>lakshman239</dc:creator>
      <dc:date>2019-02-22T12:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: help on join command please</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-join-command-please/m-p/405591#M117248</link>
      <description>&lt;P&gt;Your stats is reducing the result of first row to just have single row with count and it has nothing to join with. In fact, for your requirement, you probably don't need join. Give this version a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=* sourcetype=* ) OR (eventtype=OSBuild)
|eval OS=if(........),        Build=if(...........) 
 | stats latest(OS) as OS latest(Build) as Build by host
 | stats count as Total by OS Build
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR this (would perform better)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count WHERE index=* sourcetype=* by host 
| append [venttype=OSBuild 
     | eval OS=if(........)
         Build=if(...........) 
     | stats latest(OS) as OS latest(Build) as Build by host]
| stats values(OS) as OS values(Build) as Build by host 
| stats count as Total by OS Build
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Feb 2019 14:50:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-join-command-please/m-p/405591#M117248</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-02-22T14:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: help on join command please</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-join-command-please/m-p/405592#M117249</link>
      <description>&lt;P&gt;hi&lt;BR /&gt;
I dont undertsand why you use "OR"&lt;BR /&gt;
in the first eventtype I collect some host following a specific criteria&lt;BR /&gt;
From this host list, I want to cross these host with the second eventype&lt;BR /&gt;
thats the reason why I need to use a join command...&lt;BR /&gt;
I have done this&lt;BR /&gt;
could you confirm me its good please??&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=Flag (NOT host=E* AND NOT
    host=I*) 
| join type="outer" 
    [ search eventtype=OSBuild (NOT host=E* AND NOT
        host=I*) 
    | eval OS=if(x), 
        Build=if(x) 
    | stats latest(OS) as OS latest(Build) as Build by host 
        ] 
| stats dc(host) as Total by OS Build
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Feb 2019 15:58:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-join-command-please/m-p/405592#M117249</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2019-02-22T15:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: help on join command please</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-join-command-please/m-p/405593#M117250</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;(eventtype=Flag OR eventtype=OSBuild) NOT (host=E* host=I*)
| dedup host eventtype
|  eval OS=if(eventtype=OSBuild AND (x), 'y', OS),
        Build=if(eventtype=OSBuild AND (x), 'y', Build)
| stats dc(host) as Total by OS, Build
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It looks like you're trying to populate OSBuild events with a field that already exists in Flag. If so, this should work. &lt;BR /&gt;
Edit: if the stuff you're evaluating in OSBuild can be null, move the dedup after the eval and use &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| search OS=* Build=*
|dedup host eventtype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Should still be more performant than join I think&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 16:17:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-join-command-please/m-p/405593#M117250</guid>
      <dc:creator>camillak</dc:creator>
      <dc:date>2019-02-22T16:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: help on join command please</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-join-command-please/m-p/405594#M117251</link>
      <description>&lt;P&gt;The only common field is host &lt;BR /&gt;
What méans 'y' please?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 17:34:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-join-command-please/m-p/405594#M117251</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2019-02-22T17:34:26Z</dc:date>
    </item>
  </channel>
</rss>

