<?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: Searching with AND OR in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Searching-with-AND-OR/m-p/103366#M26721</link>
    <description>&lt;P&gt;with AND you get this result set&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;id | name | expected result
----------------------------
no | no | none are reported
yes | no | none are reported
no| yes | none are reported
yes | yes | Both are reported
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;id | name | expected result
----------------------------------
no | no | none are reported
yes | no | id is reported
no| yes | name is reported
yes | yes | Both  name and id are reported
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Based on these premises you want to use OR&lt;/P&gt;

&lt;P&gt;index=someindex id OR name|table _time id name&lt;/P&gt;</description>
    <pubDate>Tue, 29 Jan 2013 17:32:21 GMT</pubDate>
    <dc:creator>lpolo</dc:creator>
    <dc:date>2013-01-29T17:32:21Z</dc:date>
    <item>
      <title>Searching with AND OR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Searching-with-AND-OR/m-p/103365#M26720</link>
      <description>&lt;P&gt;I am trying to setup a dashboard with the following example search.  What I need to do is have both id and or name, I tried it with just OR but if it matches on the first it will not continue on the second and it breaks with AND OR...?&lt;/P&gt;

&lt;P&gt;index=someindex id=* AND OR name=*&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jan 2013 17:21:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Searching-with-AND-OR/m-p/103365#M26720</guid>
      <dc:creator>jlaigo2</dc:creator>
      <dc:date>2013-01-29T17:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: Searching with AND OR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Searching-with-AND-OR/m-p/103366#M26721</link>
      <description>&lt;P&gt;with AND you get this result set&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;id | name | expected result
----------------------------
no | no | none are reported
yes | no | none are reported
no| yes | none are reported
yes | yes | Both are reported
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;id | name | expected result
----------------------------------
no | no | none are reported
yes | no | id is reported
no| yes | name is reported
yes | yes | Both  name and id are reported
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Based on these premises you want to use OR&lt;/P&gt;

&lt;P&gt;index=someindex id OR name|table _time id name&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jan 2013 17:32:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Searching-with-AND-OR/m-p/103366#M26721</guid>
      <dc:creator>lpolo</dc:creator>
      <dc:date>2013-01-29T17:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: Searching with AND OR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Searching-with-AND-OR/m-p/103367#M26722</link>
      <description>&lt;P&gt;lpolo has the correct answer, but I thought I'd clarify a bit.&lt;/P&gt;

&lt;P&gt;The operators match criteria, so:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;AND&lt;/STRONG&gt; - is used in the format  if(id=? AND name=?,TRUE, FALSE) so both criteria, working on a boolean basis, should return 1, then it will carry on and return true.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;OR&lt;/STRONG&gt; - is used in the format if(id=? OR name=?, TRUE, FALSE) so it will continue if either of the fields match&lt;/P&gt;

&lt;P&gt;What you're attempting to do, is to check if the ID matches, or the name matches, then you wish to display the ID and the Name, so you should be using the OR; index=yourindex id=? OR name=? | table _time, id, name &lt;/P&gt;

&lt;P&gt;Hope that cleared things up.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Feb 2015 12:49:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Searching-with-AND-OR/m-p/103367#M26722</guid>
      <dc:creator>markthompson</dc:creator>
      <dc:date>2015-02-23T12:49:48Z</dc:date>
    </item>
  </channel>
</rss>

