<?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 does the AND operator does not return results? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Why-does-the-AND-operator-does-not-return-results/m-p/396580#M95121</link>
    <description>&lt;P&gt;Hi @bugnet,&lt;/P&gt;

&lt;P&gt;The &lt;CODE&gt;AND&lt;/CODE&gt; does not work because the tag for the same source are not for the same event, they are for multiple events with the same source field. When using &lt;CODE&gt;AND&lt;/CODE&gt; a single event MUST match all the conditions.&lt;/P&gt;

&lt;P&gt;In your case you have to use the &lt;CODE&gt;OR&lt;/CODE&gt; and the most efficient way to keep the one that matches all three conditions is as follows : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (index=misp-events source="/var/scripts/events/*.json") (tag_name="misp-galaxy:continents=\"Asia\"" OR tag_name="misp-galaxy:targeted-region=\"Ukraine\"" OR tag_name="misp-galaxy:ransomware=\"*") |stats dc(tag_name) as n_of_tags, values(tag_name) as tag_name by source |where n_of_tags &amp;gt;2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David&lt;/P&gt;</description>
    <pubDate>Sun, 02 Jun 2019 12:02:11 GMT</pubDate>
    <dc:creator>DavidHourani</dc:creator>
    <dc:date>2019-06-02T12:02:11Z</dc:date>
    <item>
      <title>Why does the AND operator does not return results?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-does-the-AND-operator-does-not-return-results/m-p/396579#M95120</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;for some reason AND operator does not return the results, while OR operator does. &lt;BR /&gt;
What is the way to get only the first result in the following table? &lt;/P&gt;

&lt;P&gt;search: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=misp-events source="/var/scripts/events/*.json") (tag_name="misp-galaxy:continents=\"Asia\"" OR tag_name="misp-galaxy:targeted-region=\"Ukraine\"" OR tag_name="misp-galaxy:ransomware=\"*") | transaction source|table source,tag_name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Table:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7123i32DECE321DCC0115/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jun 2019 08:53:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-does-the-AND-operator-does-not-return-results/m-p/396579#M95120</guid>
      <dc:creator>bugnet</dc:creator>
      <dc:date>2019-06-02T08:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the AND operator does not return results?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-does-the-AND-operator-does-not-return-results/m-p/396580#M95121</link>
      <description>&lt;P&gt;Hi @bugnet,&lt;/P&gt;

&lt;P&gt;The &lt;CODE&gt;AND&lt;/CODE&gt; does not work because the tag for the same source are not for the same event, they are for multiple events with the same source field. When using &lt;CODE&gt;AND&lt;/CODE&gt; a single event MUST match all the conditions.&lt;/P&gt;

&lt;P&gt;In your case you have to use the &lt;CODE&gt;OR&lt;/CODE&gt; and the most efficient way to keep the one that matches all three conditions is as follows : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (index=misp-events source="/var/scripts/events/*.json") (tag_name="misp-galaxy:continents=\"Asia\"" OR tag_name="misp-galaxy:targeted-region=\"Ukraine\"" OR tag_name="misp-galaxy:ransomware=\"*") |stats dc(tag_name) as n_of_tags, values(tag_name) as tag_name by source |where n_of_tags &amp;gt;2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jun 2019 12:02:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-does-the-AND-operator-does-not-return-results/m-p/396580#M95121</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-06-02T12:02:11Z</dc:date>
    </item>
  </channel>
</rss>

