<?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: Search returns &amp;quot;No results found&amp;quot;, when it should be returning 1. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-returns-quot-No-results-found-quot-when-it-should-be/m-p/301430#M90761</link>
    <description>&lt;P&gt;A couple of things:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Line 5 will return a zero if there are no results, so line six isn't necessary.&lt;/LI&gt;
&lt;LI&gt;Line 7 will never return anything because it is a case statement which requires a ClientID field that equals "WHI".  The stats command in line 5 got rid of that field.  To get that to evaluate the way you want, change line 7 to &lt;CODE&gt;| eval end = 1 - lateEnds&lt;/CODE&gt;&lt;/LI&gt;
&lt;/OL&gt;</description>
    <pubDate>Mon, 09 Oct 2017 21:42:58 GMT</pubDate>
    <dc:creator>justinatpnnl</dc:creator>
    <dc:date>2017-10-09T21:42:58Z</dc:date>
    <item>
      <title>Search returns "No results found", when it should be returning 1.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-returns-quot-No-results-found-quot-when-it-should-be/m-p/301429#M90760</link>
      <description>&lt;P&gt;The search below looks for an event for a specific client during a specific time. If the event is not there, I would want to be notified, thus a "1" should be returned. &lt;/P&gt;

&lt;P&gt;There is no event, so noNull is 0. The case statement "end" should be "1-0" (1-noNull), so 1 should be returned. However, I get "No results found." FYI: the search does work is noNull is 1.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=*D:\\FHSO\\imports* source=*daily\\imports* End earliest=-30h@h
| eval time=strftime(round(strptime(file_Time, "%I:%M:%S %P")), "%H:%M:%S")
| where ClientID="WHI"
| where ((like(source,"%"."WHI"."%")) AND time&amp;gt;"02:00:00" AND time&amp;lt;"02:25:00")
| stats count as lateEnds 
| eval noNull = if(ISNULL(lateEnds),0,lateEnds)
| eval end = case(ClientID="WHI", 1-noNull ) | table end
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Oct 2017 21:30:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-returns-quot-No-results-found-quot-when-it-should-be/m-p/301429#M90760</guid>
      <dc:creator>griffinpair</dc:creator>
      <dc:date>2017-10-09T21:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Search returns "No results found", when it should be returning 1.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-returns-quot-No-results-found-quot-when-it-should-be/m-p/301430#M90761</link>
      <description>&lt;P&gt;A couple of things:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Line 5 will return a zero if there are no results, so line six isn't necessary.&lt;/LI&gt;
&lt;LI&gt;Line 7 will never return anything because it is a case statement which requires a ClientID field that equals "WHI".  The stats command in line 5 got rid of that field.  To get that to evaluate the way you want, change line 7 to &lt;CODE&gt;| eval end = 1 - lateEnds&lt;/CODE&gt;&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Mon, 09 Oct 2017 21:42:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-returns-quot-No-results-found-quot-when-it-should-be/m-p/301430#M90761</guid>
      <dc:creator>justinatpnnl</dc:creator>
      <dc:date>2017-10-09T21:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: Search returns "No results found", when it should be returning 1.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-returns-quot-No-results-found-quot-when-it-should-be/m-p/301431#M90762</link>
      <description>&lt;P&gt;Hi griffinpair,&lt;BR /&gt;
try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="*D:\FHSO\imports*" source="*daily\imports*" End earliest=-30h@h ClientID="WHI"
| eval time=strftime(round(strptime(file_Time, "%I:%M:%S %P")), "%H:%M:%S")
| eval isEvent=if(like(source,"%"."WHI"."%") AND time&amp;gt;"02:00:00" AND time&amp;lt;"02:25:00",1,0)
| stats count as myCount sum(isEvent) AS isEvent
| eval noNull=if(isEvent&amp;gt;0, isEvent, myCount)
| eval end = case(ClientID="WHI","1-"+noNull)
| table end
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The main search is strange because you used two conditions for source connected by AND clause: running only the main search have you results?.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;BR /&gt;
P.S.: add always index in your search, is quicker!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 07:32:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-returns-quot-No-results-found-quot-when-it-should-be/m-p/301431#M90762</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-10-10T07:32:33Z</dc:date>
    </item>
  </channel>
</rss>

