<?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 OR operator problem in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/OR-operator-problem/m-p/349086#M174860</link>
    <description>&lt;P&gt;Hi all, &lt;/P&gt;

&lt;P&gt;Hey, what's wrong with the next search structure?&lt;BR /&gt;
I'm using OR operator because the field names are different in each index. &lt;/P&gt;

&lt;P&gt;(index=fw product=barracuda severity&amp;gt;=5 geo!=Greece)&lt;BR /&gt;
OR (index=apache msg!=error )&lt;BR /&gt;
OR (index=nac Name!="pass" Name!="manage"  Name!="error")&lt;BR /&gt;
AND src_ip!=10.0.0.0/8  src_ip!=172.16.0.0/12 src_ip!=192.168.0.0/16&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 13:49:35 GMT</pubDate>
    <dc:creator>bugnet</dc:creator>
    <dc:date>2020-09-29T13:49:35Z</dc:date>
    <item>
      <title>OR operator problem</title>
      <link>https://community.splunk.com/t5/Splunk-Search/OR-operator-problem/m-p/349086#M174860</link>
      <description>&lt;P&gt;Hi all, &lt;/P&gt;

&lt;P&gt;Hey, what's wrong with the next search structure?&lt;BR /&gt;
I'm using OR operator because the field names are different in each index. &lt;/P&gt;

&lt;P&gt;(index=fw product=barracuda severity&amp;gt;=5 geo!=Greece)&lt;BR /&gt;
OR (index=apache msg!=error )&lt;BR /&gt;
OR (index=nac Name!="pass" Name!="manage"  Name!="error")&lt;BR /&gt;
AND src_ip!=10.0.0.0/8  src_ip!=172.16.0.0/12 src_ip!=192.168.0.0/16&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:49:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/OR-operator-problem/m-p/349086#M174860</guid>
      <dc:creator>bugnet</dc:creator>
      <dc:date>2020-09-29T13:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: OR operator problem</title>
      <link>https://community.splunk.com/t5/Splunk-Search/OR-operator-problem/m-p/349087#M174861</link>
      <description>&lt;P&gt;What makes you think something is wrong?&lt;BR /&gt;&lt;BR /&gt;
There is a missing '=' before "manage", but I assume that's in the question and not in the query.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 13:07:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/OR-operator-problem/m-p/349087#M174861</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-04-25T13:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: OR operator problem</title>
      <link>https://community.splunk.com/t5/Splunk-Search/OR-operator-problem/m-p/349088#M174862</link>
      <description>&lt;P&gt;Item 1 - Computer Science 101:  mixing ORs and ANDs without specifying order of operation.  &lt;/P&gt;

&lt;P&gt;Assuming it's what you mean, try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;((index=fw product=barracuda severity&amp;gt;=5 geo!=Greece)
OR (index=apache msg!=error )
OR (index=nac Name!="pass" Name!="manage" Name!="error"))
AND ( rc_ip!=10.0.0.0/8 AND  src_ip!=172.16.0.0/12 AND src_ip!=192.168.0.0/16)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Item 2 -  IP specification&lt;/P&gt;

&lt;P&gt;For the second phrase, you probably mean...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;AND NOT
((src_ip&amp;gt;=10.0.0.0 AND  src_ip&amp;lt;=10.0.0.8 ) OR 
 (src_ip&amp;gt;=172.16.0.0 AND  src_ip&amp;lt;=172.16.0.12 ) OR 
 (src_ip&amp;gt;=192.168.0.0 AND  src_ip&amp;lt;=192.168.0.16 ) )
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...except that's not right either, since it's lexicographical comparison, but you get the idea.&lt;/P&gt;

&lt;P&gt;Myself, I'd probably break that out into a separate search or regex, as the first verb after the initial search, which might look something like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| regex rc_ip!="^10\.0\.0\.[0-8]|172\.16\.0\.([2-90]|1[0-2]?)|192\.168\.0\.([2-90]|1[0-6]?)$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| search NOT match(rc_ip,"^10\.0\.0\.[0-8]|172\.16\.0\.([2-90]|1[0-2]?)|192\.168\.0\.([2-90]|1[0-6]?)$")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where NOT match(rc_ip,"^10\.0\.0\.[0-8]|172\.16\.0\.([2-90]|1[0-2]?)|192\.168\.0\.([2-90]|1[0-6]?)$")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Apr 2017 12:53:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/OR-operator-problem/m-p/349088#M174862</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-04-26T12:53:32Z</dc:date>
    </item>
  </channel>
</rss>

