<?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 is my search with a where condition not filtering results as expected? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-a-where-condition-not-filtering-results-as/m-p/237873#M70659</link>
    <description>&lt;P&gt;It should work for any &lt;CODE&gt;span&lt;/CODE&gt;. You could test by removing everything from the &lt;CODE&gt;untable&lt;/CODE&gt; command. Maybe there's nothing with &amp;gt;25?&lt;/P&gt;</description>
    <pubDate>Mon, 15 Aug 2016 22:09:17 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2016-08-15T22:09:17Z</dc:date>
    <item>
      <title>Why is my search with a where condition not filtering results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-a-where-condition-not-filtering-results-as/m-p/237867#M70653</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;We have a search which gives us average CPU time by host and we want to plot a line graph to get hosts which have CPU usage greater than 25%.&lt;/P&gt;

&lt;P&gt;Our search below is giving us results, but when we filter results like &lt;CODE&gt;search host&amp;gt;25&lt;/CODE&gt;, it is filtering the results, but it is displaying other hosts during that time.&lt;/P&gt;

&lt;P&gt;Ex: If we need to check CPU perc on *linux1, linux2, linux3, and we have CPU&amp;gt;25 for linux1 at 10 mins ago, we are getting results for other hosts as well.&lt;/P&gt;

&lt;P&gt;Results we are getting like below, but we are looking only for &amp;gt;25 (linux1 here below)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  _time    linux1    linux2     linux3
  10.00    27        16         17
  10.10    30        18         20
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=idx1 sourcetype=cpu host=linux1* OR host=linux2* OR host=linux3*  all                | rex field=host "(?P&amp;lt;hostname&amp;gt;[^.]+)"             | eval hostname=lower(hostname) `linux_hostname`                       | eval linuxCPU=100 - pctIdle  | timechart span=10m avg(linuxCPU) as cpu by hostname  useother=f limit=0
|search linux3&amp;gt;25 OR linux2&amp;gt;25 OR linux1 &amp;gt;25
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;We should results like &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time     linux1
10.00     27
10.10     25
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Aug 2016 20:54:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-a-where-condition-not-filtering-results-as/m-p/237867#M70653</guid>
      <dc:creator>splunker9999</dc:creator>
      <dc:date>2016-08-15T20:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with a where condition not filtering results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-a-where-condition-not-filtering-results-as/m-p/237868#M70654</link>
      <description>&lt;P&gt;Give this a try&lt;BR /&gt;
&lt;STRONG&gt;Updated&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=idx1 sourcetype=cpu host=linux1* OR host=linux2* OR host=linux3*  all 
| rex field=host "(?P&amp;lt;hostname&amp;gt;[^.]+)"
| eval hostname=lower(hostname) `linux_hostname` 
| eval linuxCPU=100 - pctIdle  
| bucket span=10m _time
| stats avg(linuxCPU) as cpu by _time hostname 
|search cpu &amp;gt;25 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=idx1 sourcetype=cpu host=linux1* OR host=linux2* OR host=linux3*  all 
| rex field=host "(?P&amp;lt;hostname&amp;gt;[^.]+)"
| eval hostname=lower(hostname) `linux_hostname` 
| eval linuxCPU=100 - pctIdle  
| bucket span=10m _time
| stats avg(linuxCPU) as cpu by _time hostname 
|search cpu &amp;gt;25 
| timechart span=10m avg(cpu) as cpu by hostname  useother=f limit=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Aug 2016 20:57:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-a-where-condition-not-filtering-results-as/m-p/237868#M70654</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-08-15T20:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with a where condition not filtering results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-a-where-condition-not-filtering-results-as/m-p/237869#M70655</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=idx1 sourcetype=cpu host=linux1* OR host=linux2* OR host=linux3*  all | rex field=host "(?P&amp;lt;hostname&amp;gt;[^.]+)"  | eval hostname=lower(hostname) `linux_hostname` | eval linuxCPU=100 - pctIdle  | timechart span=10m avg(linuxCPU) as cpu by hostname  useother=f limit=0 | untable _time hostname cpu | where cpu&amp;gt;25 | xyseries _time hostname cpu
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Aug 2016 20:58:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-a-where-condition-not-filtering-results-as/m-p/237869#M70655</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-15T20:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with a where condition not filtering results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-a-where-condition-not-filtering-results-as/m-p/237870#M70656</link>
      <description>&lt;P&gt;Looks Good, Is there a way we can format time  on X axis?&lt;/P&gt;

&lt;P&gt;Currently this looks like &lt;CODE&gt;2016-08-15T00:05:00.000-07:00&lt;/CODE&gt; is not in readable format? is there a way we can get this to readable for mat something like &lt;CODE&gt;8.30AM Mon Aug 15 2016&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2016 21:27:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-a-where-condition-not-filtering-results-as/m-p/237870#M70656</guid>
      <dc:creator>splunker9999</dc:creator>
      <dc:date>2016-08-15T21:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with a where condition not filtering results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-a-where-condition-not-filtering-results-as/m-p/237871#M70657</link>
      <description>&lt;P&gt;Sure, add this to the end&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... "| eval _time=strftime(_time, "%-H.%M%p %a %b %d %Y")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Aug 2016 21:30:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-a-where-condition-not-filtering-results-as/m-p/237871#M70657</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-15T21:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with a where condition not filtering results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-a-where-condition-not-filtering-results-as/m-p/237872#M70658</link>
      <description>&lt;P&gt;Thanks, and will this not work for the span (1d or 1h)? this is not retrieving any results if I change span to 1h or 1d to check 7days period?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2016 22:00:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-a-where-condition-not-filtering-results-as/m-p/237872#M70658</guid>
      <dc:creator>splunker9999</dc:creator>
      <dc:date>2016-08-15T22:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with a where condition not filtering results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-a-where-condition-not-filtering-results-as/m-p/237873#M70659</link>
      <description>&lt;P&gt;It should work for any &lt;CODE&gt;span&lt;/CODE&gt;. You could test by removing everything from the &lt;CODE&gt;untable&lt;/CODE&gt; command. Maybe there's nothing with &amp;gt;25?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2016 22:09:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-a-where-condition-not-filtering-results-as/m-p/237873#M70659</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-15T22:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with a where condition not filtering results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-a-where-condition-not-filtering-results-as/m-p/237874#M70660</link>
      <description>&lt;P&gt;These queries are working till stats command, but afterthat they are not retrieving results because we have filtered by linux1 ,linux2 and linux3 are values not fields?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2016 22:10:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-a-where-condition-not-filtering-results-as/m-p/237874#M70660</guid>
      <dc:creator>splunker9999</dc:creator>
      <dc:date>2016-08-15T22:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with a where condition not filtering results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-a-where-condition-not-filtering-results-as/m-p/237875#M70661</link>
      <description>&lt;P&gt;My bad.. Just corrected.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 00:13:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-a-where-condition-not-filtering-results-as/m-p/237875#M70661</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-08-16T00:13:56Z</dc:date>
    </item>
  </channel>
</rss>

