<?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 negate Join Command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-negate-Join-Command/m-p/327814#M163310</link>
    <description>&lt;P&gt;Yesss! Is it possible?&lt;/P&gt;</description>
    <pubDate>Fri, 26 Jan 2018 11:43:30 GMT</pubDate>
    <dc:creator>mahbs</dc:creator>
    <dc:date>2018-01-26T11:43:30Z</dc:date>
    <item>
      <title>How to negate Join Command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-negate-Join-Command/m-p/327812#M163308</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have two sets of records, let's call them V1 and V2.  They both share a common field called ITEM. I basically need a way of saying return to me to items that are not common. So for instance, I would use a join command to join item values that are common - I need the opposite of that, wherein where items dont match, return that data.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 11:17:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-negate-Join-Command/m-p/327812#M163308</guid>
      <dc:creator>mahbs</dc:creator>
      <dc:date>2018-01-26T11:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to negate Join Command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-negate-Join-Command/m-p/327813#M163309</link>
      <description>&lt;P&gt;you want uncommon values from both v1 and v2?&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 11:43:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-negate-Join-Command/m-p/327813#M163309</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-26T11:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to negate Join Command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-negate-Join-Command/m-p/327814#M163310</link>
      <description>&lt;P&gt;Yesss! Is it possible?&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 11:43:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-negate-Join-Command/m-p/327814#M163310</guid>
      <dc:creator>mahbs</dc:creator>
      <dc:date>2018-01-26T11:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to negate Join Command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-negate-Join-Command/m-p/327815#M163311</link>
      <description>&lt;P&gt;try this run anywhere search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
 | eval item="cereal cloths pen pencil" 
 | makemv item
 | mvexpand item
 | eval check="csv1" 
 | append 
     [| makeresults 
     | eval item="tv tiffin brush cereal cloths eraser" 
     | makemv item
     | mvexpand item
     | eval check="csv2" ] 
 | fields- _time 
 | stats dc(check) as count by item
 | where count=1 
 | fields item
 | rename item as "missing item list"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In your environment, you should write&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=&amp;lt;your_index&amp;gt; v1=* | dedup ITEM | table ITEM |eval ITEM=lower(ITEM)
  | eval check="v1" 
  | append 
      [search index=&amp;lt;your_index&amp;gt;  v2=*  | dedup ITEM | table ITEM |eval ITEM=lower(ITEM)
      | eval check="v2" ] 
  | stats dc(check) as count by ITEM
  | where count=1 
  | fields ITEM
  | rename ITEM as "missing ITEM list"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 11:46:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-negate-Join-Command/m-p/327815#M163311</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-26T11:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to negate Join Command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-negate-Join-Command/m-p/327816#M163312</link>
      <description>&lt;P&gt;totally possible bro! check my query&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 11:52:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-negate-Join-Command/m-p/327816#M163312</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-26T11:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to negate Join Command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-negate-Join-Command/m-p/327817#M163313</link>
      <description>&lt;P&gt;Hi mahbs,&lt;BR /&gt;
I suppose that  in V1 and V2 you have only one occurrance of ITEM so it's possible to compare one record of V1 with one record of V2&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;searchV1
| rename field1 AS field1_v1 field2 AS field2_v1 field3 AS field3_v1
| join ITEM [ search searchV2 | rename field1 AS field1_v1 field2 AS field2_v1 field3 AS field3_v1 ]
| search NOT (field1_v1=field1_v2 OR field2_v1=field2_v2 OR field3_v1=field3_v2)
| table _time field1_v1 field1_v2 field2_v1 field2_v2 field3_v1 field3_v2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or better&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;searchV1 OR searchV2
| eval 
    field1_v1=if(searchV1,field1,""),
    field2_v1=if(searchV1,field2,""),
    field3_v1=if(searchV1,field3,""),
    field1_v2=if(searchV2,field1,""),
    field2_v2=if(searchV2,field2,""),
    field3_v2=if(searchV2,field3,""),
| stats 
   values(field1_v1) AS field1_v1 
   values(field2_v1) AS field2_v1 
   values(field3_v1) AS field3_v1 
   values(field1_v2) AS field1_v2 
   values(field2_v2) AS field2_v2 
   values(field3_v2) AS field3_v2 
  BY ITEM
  | search NOT (field1_v1=field1_v2 OR field2_v1=field2_v2 OR field3_v1=field3_v2)
  | table _time field1_v1 field1_v2 field2_v1 field2_v2 field3_v1 field3_v2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The second one is quicker.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 11:52:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-negate-Join-Command/m-p/327817#M163313</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2018-01-26T11:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to negate Join Command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-negate-Join-Command/m-p/327818#M163314</link>
      <description>&lt;P&gt;Hi mahbs,&lt;/P&gt;

&lt;P&gt;Think simple and avoid using join whenever possible.&lt;/P&gt;

&lt;P&gt;Supposing that your sets of data have different indexes, a simple stats like this should do :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=V1index OR index=V2index | stats count(index) as unique by ITEM | where unique &amp;lt; 2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will give you all the ITEM that are in either in data set v1 or v2 but not both.&lt;/P&gt;

&lt;P&gt;Another easy way to do it is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=V1index OR index=V2index | stats values(index) as type by ITEM | search NOT (type="v1" AND type="v2")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;here you will have the unique items, the set to which it belongs.&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 12:50:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-negate-Join-Command/m-p/327818#M163314</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2018-01-26T12:50:06Z</dc:date>
    </item>
  </channel>
</rss>

