<?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: compare results of two searches in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/compare-results-of-two-searches/m-p/249891#M189278</link>
    <description>&lt;P&gt;Thank you mhpark,&lt;BR /&gt;
this is working and i can see the missing results.&lt;BR /&gt;
but my questions now is how can i know in which index this result appears!?&lt;/P&gt;

&lt;P&gt;for ex:&lt;BR /&gt;
1 host_name occurrence is 1, which means its in one index search result not in the other one, but how can i tell in which one!?&lt;BR /&gt;
because actually, I'm interested to know the host names that are in index=os_windows and not in index=symantec_sep&lt;/P&gt;

&lt;P&gt;thanks in advance&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 10:46:24 GMT</pubDate>
    <dc:creator>aliroumani</dc:creator>
    <dc:date>2020-09-29T10:46:24Z</dc:date>
    <item>
      <title>compare results of two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/compare-results-of-two-searches/m-p/249887#M189274</link>
      <description>&lt;P&gt;i have to searches :&lt;BR /&gt;
1) index=symantec_sep sourcetype="symantec:ep:scan:file" | dedup dest  |table dest | sort dest&lt;BR /&gt;
2) index=os_windows Workstation_Name="*"| dedup Workstation_Name | table Workstation_Name | sort Workstation_Name&lt;/P&gt;

&lt;P&gt;both shows the workstations in environment (1st named as dest from symantec sep) &amp;amp; (2nd is named Workstation_Name).&lt;BR /&gt;
i need to run as earch to compare the results of both searches, remove duplicates and show me only missing machines:&lt;BR /&gt;
ex:&lt;BR /&gt;
1st search result is:&lt;BR /&gt;
dest&lt;BR /&gt;
abcd1020&lt;BR /&gt;
fgh123&lt;BR /&gt;
bnm1n1&lt;/P&gt;

&lt;P&gt;2nd search result is:&lt;BR /&gt;
Workstation_Name&lt;BR /&gt;
kil123&lt;BR /&gt;
abcd1020&lt;BR /&gt;
fgh123&lt;/P&gt;

&lt;P&gt;result should show two columns named (dest) and (Workstation_Name) and showing only missing machines in both, like:&lt;BR /&gt;
dest&lt;BR /&gt;
bnm1n1&lt;/P&gt;

&lt;P&gt;Workstation_Name&lt;BR /&gt;
kil123&lt;/P&gt;

&lt;P&gt;thanks for your help in advance guys ..................&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:45:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/compare-results-of-two-searches/m-p/249887#M189274</guid>
      <dc:creator>aliroumani</dc:creator>
      <dc:date>2020-09-29T10:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: compare results of two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/compare-results-of-two-searches/m-p/249888#M189275</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=symantec_sep sourcetype="symantec:ep:scan:file" | dedup dest | table dest | sort dest | appendcols [search index=os_windows Workstation_Name="*"| dedup Workstation_Name | table Workstation_Name | sort Workstation_Name]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Aug 2016 13:00:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/compare-results-of-two-searches/m-p/249888#M189275</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-25T13:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: compare results of two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/compare-results-of-two-searches/m-p/249889#M189276</link>
      <description>&lt;P&gt;Since your indices are different,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=symantec_sep sourcetype="symantec:ep:scan:file") OR (index=os_windows Workstation_Name="*")
| eval host_name = coalesce(dest, Workstation_Name)
| stats dc(index) as occurrence by host_name
| where occurrence &amp;lt; 2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;coalesce merges two field values into one, so it's the key.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2016 13:07:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/compare-results-of-two-searches/m-p/249889#M189276</guid>
      <dc:creator>mhpark</dc:creator>
      <dc:date>2016-08-25T13:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: compare results of two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/compare-results-of-two-searches/m-p/249890#M189277</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;

&lt;P&gt;You could use the set command&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| set diff [search index=symantec_sep sourcetype="symantec:ep:scan:file" | dedup dest |table dest  ] [search index=os_windows Workstation_Name="*"| dedup Workstation_Name | table Workstation_Name | rename Workstation_Name as dest ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But this is not very good at performance. It should be better doing something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=symantec_sep sourcetype="symantec:ep:scan:file") OR (index=os_windows Workstation_Name="*") | rename Workstation_Name as dest | dedup dest, sourcetype | stats dc(sourcetype) as sourcetypes by dest | where sourcetypes=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The idea is to normalize the computer name in the dest field, then dedup by sourcetype and dest fields. And count the number of disctict sourctypes per dest. If you only have one then that computer appears only in one sourcetype.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2016 13:08:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/compare-results-of-two-searches/m-p/249890#M189277</guid>
      <dc:creator>gfuente</dc:creator>
      <dc:date>2016-08-25T13:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: compare results of two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/compare-results-of-two-searches/m-p/249891#M189278</link>
      <description>&lt;P&gt;Thank you mhpark,&lt;BR /&gt;
this is working and i can see the missing results.&lt;BR /&gt;
but my questions now is how can i know in which index this result appears!?&lt;/P&gt;

&lt;P&gt;for ex:&lt;BR /&gt;
1 host_name occurrence is 1, which means its in one index search result not in the other one, but how can i tell in which one!?&lt;BR /&gt;
because actually, I'm interested to know the host names that are in index=os_windows and not in index=symantec_sep&lt;/P&gt;

&lt;P&gt;thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:46:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/compare-results-of-two-searches/m-p/249891#M189278</guid>
      <dc:creator>aliroumani</dc:creator>
      <dc:date>2020-09-29T10:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: compare results of two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/compare-results-of-two-searches/m-p/249892#M189279</link>
      <description>&lt;P&gt;You could try making a small addition to the stats command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=symantec_sep sourcetype="symantec:ep:scan:file") OR (index=os_windows Workstation_Name="*")
 | eval host_name = coalesce(dest, Workstation_Name)
 | stats dc(index) as occurrence, values(index) as indexes by host_name
 | where occurrence &amp;lt; 2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should give you the name of the index it was found in.&lt;/P&gt;</description>
      <pubDate>Sun, 28 Aug 2016 06:47:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/compare-results-of-two-searches/m-p/249892#M189279</guid>
      <dc:creator>justinatpnnl</dc:creator>
      <dc:date>2016-08-28T06:47:39Z</dc:date>
    </item>
    <item>
      <title>Re: compare results of two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/compare-results-of-two-searches/m-p/249893#M189280</link>
      <description>&lt;P&gt;Yep, this would do the trick.&lt;BR /&gt;
and you could add the&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=os_windows
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;search/where condition after the stats.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 14:15:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/compare-results-of-two-searches/m-p/249893#M189280</guid>
      <dc:creator>mhpark</dc:creator>
      <dc:date>2016-08-29T14:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: compare results of two searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/compare-results-of-two-searches/m-p/249894#M189281</link>
      <description>&lt;P&gt;perfect answer &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
thanks a million guys .. i really appreciate it.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Sep 2016 05:07:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/compare-results-of-two-searches/m-p/249894#M189281</guid>
      <dc:creator>aliroumani</dc:creator>
      <dc:date>2016-09-04T05:07:49Z</dc:date>
    </item>
  </channel>
</rss>

