<?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: Help searching with not in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-searching-with-not/m-p/467611#M131595</link>
    <description>&lt;P&gt;It should work but try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;....| search x!=3 OR b!=3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 30 Oct 2019 02:04:17 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-10-30T02:04:17Z</dc:date>
    <item>
      <title>Help searching with not</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-searching-with-not/m-p/467609#M131593</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;
For some reason, my search doesn't work properly. &lt;BR /&gt;
The search is as the one below: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;....| search NOT (x=3 AND b=3) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Instead of excluding events with both the conditions in the parentheses, it does: not x=3 or not b=3 &lt;/P&gt;

&lt;P&gt;Can someone help me achieve what I am trying to do? &lt;/P&gt;

&lt;P&gt;Thanks &lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2019 18:08:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-searching-with-not/m-p/467609#M131593</guid>
      <dc:creator>astatrial</dc:creator>
      <dc:date>2019-10-29T18:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: Help searching with not</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-searching-with-not/m-p/467610#M131594</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;

&lt;P&gt;try &lt;CODE&gt;| search NOT (x=1 OR b=3)&lt;/CODE&gt;, this will give you the desired results.&lt;/P&gt;

&lt;P&gt;accept &amp;amp; up-vote the answer if it helps.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2019 20:09:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-searching-with-not/m-p/467610#M131594</guid>
      <dc:creator>gaurav_maniar</dc:creator>
      <dc:date>2019-10-29T20:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Help searching with not</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-searching-with-not/m-p/467611#M131595</link>
      <description>&lt;P&gt;It should work but try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;....| search x!=3 OR b!=3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Oct 2019 02:04:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-searching-with-not/m-p/467611#M131595</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-10-30T02:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: Help searching with not</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-searching-with-not/m-p/467612#M131596</link>
      <description>&lt;P&gt;I want to exclude events with both my terms, means if both x=3 and b=3 than the event will be excluded. &lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 06:54:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-searching-with-not/m-p/467612#M131596</guid>
      <dc:creator>astatrial</dc:creator>
      <dc:date>2019-10-30T06:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Help searching with not</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-searching-with-not/m-p/467613#M131597</link>
      <description>&lt;P&gt;I need both terms to exist, so this is not exactly what i need. &lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 06:56:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-searching-with-not/m-p/467613#M131597</guid>
      <dc:creator>astatrial</dc:creator>
      <dc:date>2019-10-30T06:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: Help searching with not</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-searching-with-not/m-p/467614#M131598</link>
      <description>&lt;P&gt;@astatrial &lt;/P&gt;

&lt;P&gt;I think your provided search &lt;CODE&gt;| search NOT (x=3 AND b=3)&lt;/CODE&gt; should work.&lt;/P&gt;

&lt;P&gt;check:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=10 | eval x=1 | accum x | eval b=3 | search NOT (x=3 AND b=3)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;OR&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Try&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| where NOT (x=3 AND b=3)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Check: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=10 | eval x=1 | accum x | eval b=3 | where NOT (x=3 AND b=3)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If both ways are not working then we are expecting types of both fields and sample data OR screenshots of them. You can use the below search for type.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=10 | eval x=1 | accum x | eval b=3  | eval x_t=typeof(x),b_t=typeof(b)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 07:27:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-searching-with-not/m-p/467614#M131598</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-10-30T07:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: Help searching with not</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-searching-with-not/m-p/467615#M131599</link>
      <description>&lt;P&gt;I think i had problems with the condition itself. &lt;BR /&gt;
I had a path inside and didn't use "\".&lt;/P&gt;

&lt;P&gt;Thanks all ! &lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 08:26:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-searching-with-not/m-p/467615#M131599</guid>
      <dc:creator>astatrial</dc:creator>
      <dc:date>2019-10-30T08:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: Help searching with not</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-searching-with-not/m-p/467616#M131600</link>
      <description>&lt;P&gt;Hi, &lt;BR /&gt;
Thanks, it appeared that the logic was ok but instead the problem was with the condition with the file path (that was lacked double back slashes).&lt;/P&gt;

&lt;P&gt;Any way, i will accept the answer as it helped me realize that the logic was ok.&lt;/P&gt;

&lt;P&gt;Thanks again. &lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 08:28:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-searching-with-not/m-p/467616#M131600</guid>
      <dc:creator>astatrial</dc:creator>
      <dc:date>2019-10-30T08:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: Help searching with not</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-searching-with-not/m-p/467617#M131601</link>
      <description>&lt;P&gt;&lt;CODE&gt;NOT (x=3 AND b=3)&lt;/CODE&gt; is indeed equivalent to &lt;CODE&gt;not x=3 or not b=3&lt;/CODE&gt;, as per De Morgan's law: &lt;A href="https://en.wikipedia.org/wiki/De_Morgan%27s_laws"&gt;https://en.wikipedia.org/wiki/De_Morgan%27s_laws&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;If at least one of the two fields is not equal to 3, the event will be included.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;b=1, x=2 -&amp;gt; included
b=3, x=2 -&amp;gt; included
b=2, x=3 -&amp;gt; included
b=3, x=3 -&amp;gt; not included
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The alternative would be &lt;CODE&gt;x!=3 AND b!=3&lt;/CODE&gt;. Which, again by De Morgan's law, is actually equivalent to &lt;CODE&gt;NOT (x=1 OR b=3)&lt;/CODE&gt; which @gaurav_maniar mentioned in his answer. This gives you all events where none of the 2 fields equals 3.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;b=1, x=2 -&amp;gt; included
b=3, x=2 -&amp;gt; not included
b=2, x=3 -&amp;gt; not included
b=3, x=3 -&amp;gt; not included
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which one is correct really depends on what you're after. Can you give a few example events and desired output and also an example of the output you get right now that is not according to your needs? Perhaps we're misunderstanding what you are actually after?&lt;/P&gt;

&lt;P&gt;This stuff can be a bit tricky to wrap your head around. You might want to find some boolean logic tutorials or so online, to brush up on these concepts &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 08:33:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-searching-with-not/m-p/467617#M131601</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-10-30T08:33:04Z</dc:date>
    </item>
  </channel>
</rss>

