<?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 How to find unique values between two queries? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-unique-values-between-two-queries/m-p/458607#M129483</link>
    <description>&lt;P&gt;I know I am for sure over-complicating this. I need to find values that are in field x, that are not in field y.&lt;/P&gt;

&lt;P&gt;This is my first query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=nitro_prod_loc_server earliest=-4h
| stats values("locId") as All_Locs
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This returns all locations, it requires a 4 hour timespan&lt;/P&gt;

&lt;P&gt;This is my second query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=nitro_prod_loc_server appName="nitroCheck" bdy.addInfo{}.key="Serial Number" 
| stats values("locId") as "Checked_Locs"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This returns a list of locations that have been checked, it needs the time to be set to all time.&lt;/P&gt;

&lt;P&gt;I want a list of locations not found in the second query. Any suggestions?&lt;/P&gt;</description>
    <pubDate>Mon, 13 May 2019 21:00:23 GMT</pubDate>
    <dc:creator>JoshuaJohn</dc:creator>
    <dc:date>2019-05-13T21:00:23Z</dc:date>
    <item>
      <title>How to find unique values between two queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-unique-values-between-two-queries/m-p/458607#M129483</link>
      <description>&lt;P&gt;I know I am for sure over-complicating this. I need to find values that are in field x, that are not in field y.&lt;/P&gt;

&lt;P&gt;This is my first query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=nitro_prod_loc_server earliest=-4h
| stats values("locId") as All_Locs
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This returns all locations, it requires a 4 hour timespan&lt;/P&gt;

&lt;P&gt;This is my second query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=nitro_prod_loc_server appName="nitroCheck" bdy.addInfo{}.key="Serial Number" 
| stats values("locId") as "Checked_Locs"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This returns a list of locations that have been checked, it needs the time to be set to all time.&lt;/P&gt;

&lt;P&gt;I want a list of locations not found in the second query. Any suggestions?&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 21:00:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-unique-values-between-two-queries/m-p/458607#M129483</guid>
      <dc:creator>JoshuaJohn</dc:creator>
      <dc:date>2019-05-13T21:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to find unique values between two queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-unique-values-between-two-queries/m-p/458608#M129484</link>
      <description>&lt;P&gt;Hi JoshuaJohn,&lt;/P&gt;

&lt;P&gt;you should not use &lt;CODE&gt;join&lt;/CODE&gt; for reasons.&lt;/P&gt;

&lt;P&gt;You can use a &lt;CODE&gt;multireport&lt;/CODE&gt; to do this, and this SPL is un-tested so you might have to modify it to match &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| multireport
[  search index=nitro_prod_loc_server earliest=-4h
 | stats values("locId") as All_Locs ]
[ search index=nitro_prod_loc_server appName="nitroCheck" bdy.addInfo{}.key="Serial Number" 
 | stats values("locId") as "Checked_Locs" ]
| streamstats count(index) AS c_idx
| where c_idx &amp;lt; 2 AND isnull(appName)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This would assume you have no &lt;CODE&gt;appName&lt;/CODE&gt; field returned from the first search.&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 21:12:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-unique-values-between-two-queries/m-p/458608#M129484</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2019-05-13T21:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to find unique values between two queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-unique-values-between-two-queries/m-p/458609#M129485</link>
      <description>&lt;P&gt;Ah I do have an appName returned from the first field, it always returns something (regardless if its set to specifically return)&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 13:51:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-unique-values-between-two-queries/m-p/458609#M129485</guid>
      <dc:creator>JoshuaJohn</dc:creator>
      <dc:date>2019-05-14T13:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to find unique values between two queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-unique-values-between-two-queries/m-p/458610#M129486</link>
      <description>&lt;P&gt;Got it&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| multisearch 
 [ search index=-### appName="NotifiCenter" earliest=-4h]
 [ search index=-### appName="NitroCheck" bdy.addInfo{}.key="Serial Number" ]
 | stats values(locId) as location distinct_count(locId) AS c_idx by appName
 | stats count(appName) as c_appName by location
 | where c_appName &amp;lt; 2
 | table location
 | sort location asc
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 May 2019 15:25:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-unique-values-between-two-queries/m-p/458610#M129486</guid>
      <dc:creator>JoshuaJohn</dc:creator>
      <dc:date>2019-05-14T15:25:15Z</dc:date>
    </item>
  </channel>
</rss>

