<?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: Search help: remove intersection of two sets from the first set in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-help-remove-intersection-of-two-sets-from-the-first-set/m-p/31176#M6417</link>
    <description>&lt;P&gt;This can be achieved by the following search:&lt;BR /&gt;&lt;BR /&gt;
&lt;CODE&gt;source="set1.log" | JOIN type=left MAC [search source="set2.log" | eval x=1] | Where NOT x=1&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Explanation:&lt;BR /&gt;&lt;BR /&gt;
the subsearch will find events in set2.log and add a new field, x=1 to the event. (that is for D, E, F, G, the field x=1 will be associated to the events)&lt;BR /&gt;&lt;BR /&gt;
Then, were doing a LEFT JOIN, on the field MAC (which will return A B C D) , but we are leaving out those events for which x=1 (hence we are leaving out D).&lt;BR /&gt;&lt;BR /&gt;
The final result then becomes: A, B and C, that is, set1 - set2&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jun 2011 23:03:52 GMT</pubDate>
    <dc:creator>Genti</dc:creator>
    <dc:date>2011-06-20T23:03:52Z</dc:date>
    <item>
      <title>Search help: remove intersection of two sets from the first set</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-help-remove-intersection-of-two-sets-from-the-first-set/m-p/31175#M6416</link>
      <description>&lt;P&gt;A customer asked this search question a few days ago. I thought it was a good one for answers.&lt;BR /&gt;&lt;BR /&gt;
Assume you have two datasets where you can use a JOIN to find the intersection (based on a field). How can i then modify the search to list the events in the first data set that do not also show up in the second dataset?&lt;/P&gt;

&lt;P&gt;Here's a simple example:&lt;BR /&gt;&lt;BR /&gt;
&lt;CODE&gt;set1.log&lt;BR /&gt;
May 31 23:00:01 MAC=a&lt;BR /&gt;
May 31 23:00:05 MAC=b&lt;BR /&gt;
May 31 23:00:06 MAC=c&lt;BR /&gt;
May 31 23:00:07 MAC=d&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;set2.log&lt;BR /&gt;
Jun 01 00:00:01 MAC=d&lt;BR /&gt;
Jun 01 00:00:05 MAC=e&lt;BR /&gt;
Jun 01 00:00:06 MAC=f&lt;BR /&gt;
Jun 01 00:00:07 MAC=g&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Using:&lt;BR /&gt;
&lt;CODE&gt;source=set1.log | JOIN MAC [search set2.log] &lt;/CODE&gt; i should get the intersection: d&lt;BR /&gt;&lt;BR /&gt;
What should my search be, in order to get set1 - intersection of set1 and set2 (in other words, set1 - set2)?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2011 22:38:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-help-remove-intersection-of-two-sets-from-the-first-set/m-p/31175#M6416</guid>
      <dc:creator>Genti</dc:creator>
      <dc:date>2011-06-20T22:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Search help: remove intersection of two sets from the first set</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-help-remove-intersection-of-two-sets-from-the-first-set/m-p/31176#M6417</link>
      <description>&lt;P&gt;This can be achieved by the following search:&lt;BR /&gt;&lt;BR /&gt;
&lt;CODE&gt;source="set1.log" | JOIN type=left MAC [search source="set2.log" | eval x=1] | Where NOT x=1&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Explanation:&lt;BR /&gt;&lt;BR /&gt;
the subsearch will find events in set2.log and add a new field, x=1 to the event. (that is for D, E, F, G, the field x=1 will be associated to the events)&lt;BR /&gt;&lt;BR /&gt;
Then, were doing a LEFT JOIN, on the field MAC (which will return A B C D) , but we are leaving out those events for which x=1 (hence we are leaving out D).&lt;BR /&gt;&lt;BR /&gt;
The final result then becomes: A, B and C, that is, set1 - set2&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2011 23:03:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-help-remove-intersection-of-two-sets-from-the-first-set/m-p/31176#M6417</guid>
      <dc:creator>Genti</dc:creator>
      <dc:date>2011-06-20T23:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: Search help: remove intersection of two sets from the first set</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-help-remove-intersection-of-two-sets-from-the-first-set/m-p/31177#M6418</link>
      <description>&lt;P&gt;I'd assume that the following would be more efficient, but I haven't tried it out.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=set1.log NOT [search source=set2.log | dedup MAC | fields + MAC ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i.e find all MACs from set2, then show all events from set1 whose MAC addresses do not match the subsearch.&lt;/P&gt;

&lt;P&gt;/kristian&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2011 20:30:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-help-remove-intersection-of-two-sets-from-the-first-set/m-p/31177#M6418</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2011-11-18T20:30:40Z</dc:date>
    </item>
  </channel>
</rss>

