<?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: Why is my search with &amp;quot;where NOT equals this OR this OR this&amp;quot; not filtering out results as expected? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/267256#M80395</link>
    <description>&lt;P&gt;If you are wanting to include multiple NOTs you have to use ANDs not ORs so that it becomes an inclusive statement = and not this and not this and not this. At a high level let's say you want not include something with "foo". If you say NOT foo OR bar, "foo" is evaluated against "foo" but then also evaluated against "bar". Because foo!=bar the event with foo makes it through the filter.&lt;/P&gt;

&lt;P&gt;Try the following&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where NOT MsgId=="AUT22673" AND NOT MsgId=="AUT23574" AND NOT MsgId=="AUT20915" AND NOT MsgId=="AUT22886"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note that in Splunk when you are including multiple evaluations in a where or eval statement you have to include the boolean AND.&lt;/P&gt;

&lt;P&gt;Any particular reason why you are searching for those events and then looking for events that don't meet your search criteria?&lt;/P&gt;</description>
    <pubDate>Tue, 08 Dec 2015 19:38:17 GMT</pubDate>
    <dc:creator>Runals</dc:creator>
    <dc:date>2015-12-08T19:38:17Z</dc:date>
    <item>
      <title>Why is my search with "where NOT equals this OR this OR this" not filtering out results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/267253#M80392</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| dedup _raw
| where NOT MsgId=="AUT22673" OR MsgId=="AUT23574" OR MsgId=="AUT20915" OR MsgId=="AUT22886"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What am I doing wrong here? I expect it to disregard events with that criteria. Its bringing up events with those MsgIds.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2015 19:01:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/267253#M80392</guid>
      <dc:creator>jsven7</dc:creator>
      <dc:date>2015-12-08T19:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with "where NOT equals this OR this OR this" not filtering out results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/267254#M80393</link>
      <description>&lt;P&gt;Full code&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mysearch... (MsgId=AUT22670 OR MsgId=AUT24414 OR  MsgId=AUT22673 OR MsgId=AUT23574 OR MsgId=AUT20915 OR MsgId=AUT22886)
| dedup User 
| where NOT MsgId=="AUT22673" OR MsgId=="AUT23574" OR MsgId=="AUT20915" OR MsgId=="AUT22886"
| eval Cluster="C"+substr(Node,10,1)  
| table MsgId
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Dec 2015 19:13:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/267254#M80393</guid>
      <dc:creator>jsven7</dc:creator>
      <dc:date>2015-12-08T19:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with "where NOT equals this OR this OR this" not filtering out results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/267255#M80394</link>
      <description>&lt;P&gt;Have you tried to exclude those values in the search portion, so it would go like&lt;/P&gt;

&lt;P&gt;`mysearch... where NOT MsgId=="AUT22673" OR MsgId=="AUT23574" OR MsgId=="AUT20915" OR MsgId=="AUT22886"&lt;/P&gt;

&lt;P&gt;| dedup User&lt;BR /&gt;
| eval Cluster="C"+substr(Node,10,1) &lt;BR /&gt;
| table MsgId`&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2015 19:26:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/267255#M80394</guid>
      <dc:creator>_dave_b</dc:creator>
      <dc:date>2015-12-08T19:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with "where NOT equals this OR this OR this" not filtering out results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/267256#M80395</link>
      <description>&lt;P&gt;If you are wanting to include multiple NOTs you have to use ANDs not ORs so that it becomes an inclusive statement = and not this and not this and not this. At a high level let's say you want not include something with "foo". If you say NOT foo OR bar, "foo" is evaluated against "foo" but then also evaluated against "bar". Because foo!=bar the event with foo makes it through the filter.&lt;/P&gt;

&lt;P&gt;Try the following&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where NOT MsgId=="AUT22673" AND NOT MsgId=="AUT23574" AND NOT MsgId=="AUT20915" AND NOT MsgId=="AUT22886"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note that in Splunk when you are including multiple evaluations in a where or eval statement you have to include the boolean AND.&lt;/P&gt;

&lt;P&gt;Any particular reason why you are searching for those events and then looking for events that don't meet your search criteria?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2015 19:38:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/267256#M80395</guid>
      <dc:creator>Runals</dc:creator>
      <dc:date>2015-12-08T19:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with "where NOT equals this OR this OR this" not filtering out results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/267257#M80396</link>
      <description>&lt;P&gt;Hi jsven,&lt;/P&gt;

&lt;P&gt;I don't know why you do it this way, because your base search is searching for the multiple &lt;CODE&gt;MsgId&lt;/CODE&gt; but further down the pipe you discard them again....could it be those are multivalve fields and/or your events are not properly line broken? Anyway, probably you have a reason to do so; so let me help you....&lt;/P&gt;

&lt;P&gt;try this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mysearch... (MsgId=AUT22670 OR MsgId=AUT24414 OR  MsgId=AUT22673 OR MsgId=AUT23574 OR MsgId=AUT20915 OR MsgId=AUT22886)
 | dedup User 
 | search NOT MsgId="AUT22673" OR NOT MsgId="AUT23574" OR NOT MsgId="AUT20915" OR NOT MsgId="AUT22886"
 | eval Cluster="C"+substr(Node,10,1)  
 | table MsgId
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Keep in mind, try to avoid &lt;CODE&gt;NOT&lt;/CODE&gt; search, instead search for what you want and need. &lt;/P&gt;

&lt;P&gt;Also keep in mind if you have multi value fields, it will still match events which for example holds a value of &lt;CODE&gt;MsgId="AUT11111, AUT20915"&lt;/CODE&gt;. To remove those events as well use the &lt;CODE&gt;NOT MsgId="*AUT20915*"&lt;/CODE&gt;, but this will be a bad performer on large searches. &lt;/P&gt;

&lt;P&gt;Here is a link to a &lt;CODE&gt;.conf&lt;/CODE&gt; slide about Search Efficiency Optimisation &lt;A href="http://conf.splunk.com/session/2015/conf2015_JHarty_DuncanTurnbull_Splunk_UsingSplunkSearchLanguage_AQuickGuideToSearch.pdf"&gt;http://conf.splunk.com/session/2015/conf2015_JHarty_DuncanTurnbull_Splunk_UsingSplunkSearchLanguage_AQuickGuideToSearch.pdf&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2015 19:39:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/267257#M80396</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-12-08T19:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with "where NOT equals this OR this OR this" not filtering out results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/267258#M80397</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| dedup _raw
| where NOT (MsgId=="AUT22673" OR MsgId=="AUT23574" OR MsgId=="AUT20915" OR MsgId=="AUT22886")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Dec 2015 20:56:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/267258#M80397</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-12-08T20:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with "where NOT equals this OR this OR this" not filtering out results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/267259#M80398</link>
      <description>&lt;P&gt;Thanks Runals! I'm trying to identify open sessions. AUT24414 and AUT22673 represent a login. AUT22673, AUT23574, AUT20915, AUT22886 represent logouts. So if I dedup per User ID and then disregard the logouts I can report on open sessions. &lt;/P&gt;

&lt;P&gt;Courtesy of @jplumsdaine22.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2015 14:12:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/267259#M80398</guid>
      <dc:creator>jsven7</dc:creator>
      <dc:date>2015-12-09T14:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with "where NOT equals this OR this OR this" not filtering out results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/267260#M80399</link>
      <description>&lt;P&gt;or use regex: | regex All_Traffic.app !="not-applicable|bob|blah"&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 18:43:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/267260#M80399</guid>
      <dc:creator>dbroggy</dc:creator>
      <dc:date>2019-05-06T18:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with "where NOT equals this OR this OR this" not filtering out results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/588520#M204976</link>
      <description>&lt;P&gt;instead of explicitly specify the values, can we get result of subsearch&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where NOT [how to write another search here to return a list of values of MsgId]

E.G.,

| where NOT [search anotherField=value | fields MsgId]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2022 06:05:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/588520#M204976</guid>
      <dc:creator>QQAL2021</dc:creator>
      <dc:date>2022-03-11T06:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with "where NOT equals this OR this OR this" not filtering out results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/691040#M235348</link>
      <description>&lt;P&gt;Correct. This is also known as the De Morgan's Law of Union Or&amp;nbsp;De Morgan's Law of Intersection&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 19:25:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-quot-where-NOT-equals-this-OR-this-OR-this/m-p/691040#M235348</guid>
      <dc:creator>anwarmian</dc:creator>
      <dc:date>2024-06-18T19:25:35Z</dc:date>
    </item>
  </channel>
</rss>

