<?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 am I getting different results between these 2 searches? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-different-results-between-these-2-searches/m-p/161251#M45613</link>
    <description>&lt;P&gt;Hm, why is this not a numeric value?  Calculatiions work fine, e.g. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval sum=timestamp+_time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 19 Dec 2014 07:52:58 GMT</pubDate>
    <dc:creator>HeinzWaescher</dc:creator>
    <dc:date>2014-12-19T07:52:58Z</dc:date>
    <item>
      <title>Why am I getting different results between these 2 searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-different-results-between-these-2-searches/m-p/161249#M45611</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I'm using a search like this for a timerange of one single day:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=A
| lookup lookup.csv id OUTPUT timestamp
| bucket span=1d _time
| eval flag=if(timestamp&amp;lt;=_time, "true", "false")
| stats dc(id) AS ids by flag

 true -&amp;gt; 50
 false -&amp;gt; 10
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried out another way to verify the distinct count of ids for flag=true, but the result is different:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=A
| lookup lookup.csv id OUTPUT timestamp
| bucket span=1d _time
| search timestamp&amp;lt;=_time
| stats dc(id) AS ids

result -&amp;gt; 60
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I can't find the reason for different results here.&lt;/P&gt;

&lt;P&gt;Best regards&lt;/P&gt;

&lt;P&gt;Heinz&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;edit:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;The "search" command in the second example seems to be the reason. The result is 50 by using "where timestamp&amp;lt;=_time".&lt;BR /&gt;
Can somebody tell me the difference of search and where here?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Dec 2014 09:25:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-different-results-between-these-2-searches/m-p/161249#M45611</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2014-12-18T09:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I getting different results between these 2 searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-different-results-between-these-2-searches/m-p/161250#M45612</link>
      <description>&lt;P&gt;Your timestamp field isnt numeric.&lt;/P&gt;

&lt;P&gt;From search documentation:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.1/SearchReference/Search"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.1/SearchReference/Search&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Comparison expression
&amp;lt;cmp&amp;gt;
Syntax: = | != | &amp;lt; |  | &amp;gt;=
Description: Comparison operators. You can use comparison expressions when searching field/value pairs. Comparison expressions with "=" and "!=" work with all field/value pairs. **Comparison expressions with  = work only with fields that have numeric values**.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Dec 2014 13:34:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-different-results-between-these-2-searches/m-p/161250#M45612</guid>
      <dc:creator>pedromvieira</dc:creator>
      <dc:date>2014-12-18T13:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I getting different results between these 2 searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-different-results-between-these-2-searches/m-p/161251#M45613</link>
      <description>&lt;P&gt;Hm, why is this not a numeric value?  Calculatiions work fine, e.g. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval sum=timestamp+_time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Dec 2014 07:52:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-different-results-between-these-2-searches/m-p/161251#M45613</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2014-12-19T07:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I getting different results between these 2 searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-different-results-between-these-2-searches/m-p/161252#M45614</link>
      <description>&lt;P&gt;I've done another check which tells me that the both fields are numeric:&lt;/P&gt;

&lt;P&gt;| eval isnum=if(isnum(timestamp), "true", "false") -&amp;gt; true&lt;BR /&gt;
| eval isnum2=if(isnum(_time), "true", "false") -&amp;gt; true&lt;/P&gt;</description>
      <pubDate>Mon, 22 Dec 2014 09:32:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-different-results-between-these-2-searches/m-p/161252#M45614</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2014-12-22T09:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I getting different results between these 2 searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-different-results-between-these-2-searches/m-p/161253#M45615</link>
      <description>&lt;P&gt;Hi HeinzWaescher,&lt;/P&gt;

&lt;P&gt;The &lt;CODE&gt;search&lt;/CODE&gt; command has two functions: used at the beginning of a search pipeline, it retrieves events from an index(es); used elsewhere in the pipeline, it filters the results of a previous search command.&lt;/P&gt;

&lt;P&gt;The &lt;CODE&gt;where&lt;/CODE&gt; command also filters the results of a previous search, but it uses the same expression syntax as the eval command and keeps only the results for which the evaluation was successful.&lt;/P&gt;

&lt;P&gt;In other words, use &lt;CODE&gt;where&lt;/CODE&gt; to filter/search/compare two fields and use &lt;CODE&gt;search&lt;/CODE&gt; if you want to filter/search a specific value of some field.&lt;/P&gt;

&lt;P&gt;hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Mon, 22 Dec 2014 10:42:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-different-results-between-these-2-searches/m-p/161253#M45615</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-12-22T10:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I getting different results between these 2 searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-different-results-between-these-2-searches/m-p/161254#M45616</link>
      <description>&lt;P&gt;Thanks, I will keep that in mind!&lt;/P&gt;</description>
      <pubDate>Tue, 23 Dec 2014 12:17:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-different-results-between-these-2-searches/m-p/161254#M45616</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2014-12-23T12:17:22Z</dc:date>
    </item>
  </channel>
</rss>

