<?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: Diff of 2 searches in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Diff-of-2-searches/m-p/11457#M781</link>
    <description>&lt;P&gt;Just a quick word about &lt;CODE&gt;set diff&lt;/CODE&gt; option.  Don't forget to remove the hidden fields in your subsearch.  In your example, instead of just using &lt;CODE&gt;| fields host&lt;/CODE&gt;, you would have to use &lt;CODE&gt;| fields + host | fields - _time _raw&lt;/CODE&gt;  Otherwise, &lt;CODE&gt;set&lt;/CODE&gt; will attempt to compare your hidden fields which generally will not work out.&lt;/P&gt;</description>
    <pubDate>Mon, 26 Apr 2010 22:13:55 GMT</pubDate>
    <dc:creator>Lowell</dc:creator>
    <dc:date>2010-04-26T22:13:55Z</dc:date>
    <item>
      <title>Diff of 2 searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Diff-of-2-searches/m-p/11455#M779</link>
      <description>&lt;P&gt;How would I go about running a search that compares the output to two searches and reports the difference between the two outputs?&lt;/P&gt;

&lt;P&gt;To expand on this a little:&lt;/P&gt;

&lt;P&gt;Search 1:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;tag=pci source=/var/log/messages | top host limit=0 | fields host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Search 2:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;tag=pci source=/var/log/messages Aide | top host limit=0 | fields hosts
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to report on hosts that are in Search 1 but not in Search 2.&lt;/P&gt;

&lt;P&gt;How would I do this?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2010 13:51:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Diff-of-2-searches/m-p/11455#M779</guid>
      <dc:creator>Pete_Bassill</dc:creator>
      <dc:date>2010-04-14T13:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Diff of 2 searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Diff-of-2-searches/m-p/11456#M780</link>
      <description>&lt;P&gt;You can in general use a subsearch:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;tag=pci source=/var/log/messages NOT [ search tag=pci source=/var/log/message Aide | top host limit=0 | fields host ] | top host limit=0 | fields host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but really in the case of your specific search you may be able to simply do:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;tag=pci source=/var/log/messages NOT Aide | top host limit=0 | fields host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In other cases, you can also consider the &lt;CODE&gt;|set diff&lt;/CODE&gt; command&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2010 14:40:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Diff-of-2-searches/m-p/11456#M780</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2010-04-14T14:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: Diff of 2 searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Diff-of-2-searches/m-p/11457#M781</link>
      <description>&lt;P&gt;Just a quick word about &lt;CODE&gt;set diff&lt;/CODE&gt; option.  Don't forget to remove the hidden fields in your subsearch.  In your example, instead of just using &lt;CODE&gt;| fields host&lt;/CODE&gt;, you would have to use &lt;CODE&gt;| fields + host | fields - _time _raw&lt;/CODE&gt;  Otherwise, &lt;CODE&gt;set&lt;/CODE&gt; will attempt to compare your hidden fields which generally will not work out.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2010 22:13:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Diff-of-2-searches/m-p/11457#M781</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-04-26T22:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: Diff of 2 searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Diff-of-2-searches/m-p/11458#M782</link>
      <description>&lt;P&gt;gkanapathy's first search will work, but his seconds will not (as you have to look at the "Aide" messages to know which hosts to exclude).&lt;/P&gt;

&lt;P&gt;You can also use &lt;CODE&gt;stats&lt;/CODE&gt; to solve this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;tag=pci source=/var/log/messages | eval has_Aide = if(searchmatch("Aide"), 1, 0) | stats values(has_Aide) as has_Aide by host | search has_Aide=0 AND has_Aide!=1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Aug 2010 07:19:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Diff-of-2-searches/m-p/11458#M782</guid>
      <dc:creator>Stephen_Sorkin</dc:creator>
      <dc:date>2010-08-31T07:19:57Z</dc:date>
    </item>
  </channel>
</rss>

