<?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 if a field is NOT in the results of a subsearch in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292062#M88216</link>
    <description>&lt;P&gt;I've run out of ideas, sorry &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; &lt;BR /&gt;
I tried to implement this, and it seems it works like a charm (link to screenshot: &lt;A href="https://photos.app.goo.gl/Oo4WSGJLrbAAyHXk2"&gt;https://photos.app.goo.gl/Oo4WSGJLrbAAyHXk2&lt;/A&gt; ).&lt;BR /&gt;
I don't know, maybe it depends on version of Splunk (I use 7.0.2).&lt;/P&gt;</description>
    <pubDate>Wed, 28 Mar 2018 06:52:06 GMT</pubDate>
    <dc:creator>nryabykh</dc:creator>
    <dc:date>2018-03-28T06:52:06Z</dc:date>
    <item>
      <title>Search if a field is NOT in the results of a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292055#M88209</link>
      <description>&lt;P&gt;This question is a follow-up to one I've submitted previously, "Search if a field is in the results of a subsearch".  If my search looks like this now;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=my_index field1=abc field2=def 
  field3!=aaa
  field3!=bbb
  field3!=ccc
  field3!=ddd
  field3!=eee
  field3!=fff
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there a way to use an inputlookup table search to rewrite the search?  I've tried using NOT in front of the inputlookup search, but that didn't work.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=my_index field1=abc field2=def  [ search  NOT | inputlookup &amp;lt;filename.csv&amp;gt; | fields &amp;lt;my_field3&amp;gt; | return 100 field3]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I also tried the Splunk IN() function, but that didn't work either.  It appears that the data returned from a inputlookup is in a "OR"ed format where I need an "AND" format, and I can't figure out how to do that.  &lt;/P&gt;

&lt;P&gt;Any help will be appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 14:47:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292055#M88209</guid>
      <dc:creator>OldManEd</dc:creator>
      <dc:date>2018-03-27T14:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: Search if a field is NOT in the results of a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292056#M88210</link>
      <description>&lt;P&gt;Just place &lt;CODE&gt;NOT&lt;/CODE&gt; before the subsearch:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=my_index field1=abc field2=def NOT [ |inputlookup filename.csv | fields field3 ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Mar 2018 15:26:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292056#M88210</guid>
      <dc:creator>nryabykh</dc:creator>
      <dc:date>2018-03-27T15:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: Search if a field is NOT in the results of a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292057#M88211</link>
      <description>&lt;P&gt;nryabykh,&lt;BR /&gt;
This doesn't seem to work for me.  I altered the search as follows;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  index=my_index field1=abc field2=def  field3=*

   field3!=aaa
   field3!=bbb
   field3!=ccc
   field3!=ddd
   field3!=eee
   field3!=fff
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And then ran the search.  The "Selected Fields" showed that the specific field3 entries in the search were filtered out.  I then ran this search;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    index=my_index field1=abc field2=def  field3=*
   NOT  [ |inputlookup filename.csv | fields field3 ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And the "Selected Fields" entry showed that nothing was filtered out.  &lt;/P&gt;

&lt;P&gt;~Ed&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 16:41:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292057#M88211</guid>
      <dc:creator>OldManEd</dc:creator>
      <dc:date>2018-03-27T16:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: Search if a field is NOT in the results of a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292058#M88212</link>
      <description>&lt;P&gt;Mmm, do you have lookup &lt;CODE&gt;filename.csv&lt;/CODE&gt; with field &lt;CODE&gt;field3&lt;/CODE&gt;? My subsearch is only an example, you should use your filename and fieldname. &lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 16:51:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292058#M88212</guid>
      <dc:creator>nryabykh</dc:creator>
      <dc:date>2018-03-27T16:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: Search if a field is NOT in the results of a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292059#M88213</link>
      <description>&lt;P&gt;Understood.  But it appears that the "NOT" section of the search is only keying on the first entry in the lookup table.  As an example, I altered the search to look like what I have below;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  index=my_index field1=abc field2=def 
   field3!=aaa
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The results did not contain any events where field3 equaled "aaa".  Then I altered it again with the search below;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     index=my_index field1=abc field2=def 
    NOT  [ |inputlookup filename.csv | fields field3 ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I got the exact same results from both - no events with "aaa" but I could see events with "bbb", "ccc", etc.&lt;BR /&gt;&lt;BR /&gt;
The "field3" column in the "Filename.csv" file looks like this;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    field3
    aaa
    bbb
    ccc
    ddd
    eee
    fff
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Like I said, it appears that the inputlookup is seeing the first entry and then stops.&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 18:11:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292059#M88213</guid>
      <dc:creator>OldManEd</dc:creator>
      <dc:date>2018-03-27T18:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: Search if a field is NOT in the results of a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292060#M88214</link>
      <description>&lt;P&gt;It seems subsearch should be rounded with brackets. I thought Splunk does this automatically, but I likely mistaked.&lt;BR /&gt;
&lt;CODE&gt;index=my_index field1=abc field2=def NOT ([ |inputlookup filename.csv | fields field3 ])&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 19:46:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292060#M88214</guid>
      <dc:creator>nryabykh</dc:creator>
      <dc:date>2018-03-27T19:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: Search if a field is NOT in the results of a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292061#M88215</link>
      <description>&lt;P&gt;nryabykh,&lt;BR /&gt;
Nope.  I added the parenthesis and it still did not work.  I got the same number of returns with some of the data that should have been filtered.&lt;BR /&gt;&lt;BR /&gt;
~Ed&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 20:01:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292061#M88215</guid>
      <dc:creator>OldManEd</dc:creator>
      <dc:date>2018-03-27T20:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: Search if a field is NOT in the results of a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292062#M88216</link>
      <description>&lt;P&gt;I've run out of ideas, sorry &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; &lt;BR /&gt;
I tried to implement this, and it seems it works like a charm (link to screenshot: &lt;A href="https://photos.app.goo.gl/Oo4WSGJLrbAAyHXk2"&gt;https://photos.app.goo.gl/Oo4WSGJLrbAAyHXk2&lt;/A&gt; ).&lt;BR /&gt;
I don't know, maybe it depends on version of Splunk (I use 7.0.2).&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 06:52:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292062#M88216</guid>
      <dc:creator>nryabykh</dc:creator>
      <dc:date>2018-03-28T06:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: Search if a field is NOT in the results of a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292063#M88217</link>
      <description>&lt;P&gt;nryabykh,&lt;/P&gt;

&lt;P&gt;OMG!  I found my problem.  ~Operator Error~  After banging my head against a wall on this issue I took a good look at it.  In the CSV file I had this;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;field3,
"""aaa""",
"""bbb""",
"""ccc""",
"""ddd""",
"""eee""",
"""fff""",
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When I loaded the lookup, the actual data the search was trying to match to had double quotes in the string, (It was trying to match "aaa", not just aaa.).  I removed all the quotes in the CSV file and everything worked.  &lt;/P&gt;

&lt;P&gt;Sorry I drug you into this one but thanks a ton for your help.  I appreciate it.&lt;/P&gt;

&lt;P&gt;~Ed&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 13:49:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292063#M88217</guid>
      <dc:creator>OldManEd</dc:creator>
      <dc:date>2018-03-28T13:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: Search if a field is NOT in the results of a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292064#M88218</link>
      <description>&lt;P&gt;All right, I'm glad we cleared this up &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 14:50:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-if-a-field-is-NOT-in-the-results-of-a-subsearch/m-p/292064#M88218</guid>
      <dc:creator>nryabykh</dc:creator>
      <dc:date>2018-03-28T14:50:26Z</dc:date>
    </item>
  </channel>
</rss>

