<?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: Return host name in search even if no results are found in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Return-host-name-in-search-even-if-no-results-are-found/m-p/335589#M99661</link>
    <description>&lt;P&gt;Hi jamesmatthews,&lt;BR /&gt;
the easiest way is to create a lookup (e.g. called perimeter.csv) containing all the hosts in your perimeter (one column called "host") and then run a search like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex sourcetype="mysourcetype" 
| eval host=upper(host)
| stats count BY host
| append [  | inputlookup perimeter.csv | eval host=upper(host), count=0 | fields host count ]
| stats sum(count) AS Total BY host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this way hosts with Total=0 are the missed ones, instead hosts with Total&amp;gt;0 are OK.&lt;/P&gt;

&lt;P&gt;You can show host situation in a dashboard alche in graphic mode.&lt;BR /&gt;
You can also create an alert when Total=0 so you immediately know when there's a problem.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Mon, 11 Dec 2017 14:30:35 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2017-12-11T14:30:35Z</dc:date>
    <item>
      <title>Return host name in search even if no results are found</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Return-host-name-in-search-even-if-no-results-are-found/m-p/335586#M99658</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;

&lt;P&gt;I am very new to Splunk so apologies if this is a very simple question.&lt;/P&gt;

&lt;P&gt;Currently Splunk is monitoring application log files and i want to get the volume of log entries in a time frame.&lt;/P&gt;

&lt;P&gt;i am currently using this search:&lt;BR /&gt;
&lt;EM&gt;index=myindex sourcetype="mysourcetype" | stats count by host&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;This works fine but if a host does not log anything in a set time frame it does not appear in the search results. &lt;BR /&gt;
Is there anyway to have hosts that do not return results appear in the search results but returning a zero?&lt;/P&gt;

&lt;P&gt;From looking around on Splunk answers i am guessing its achievable using a lookup but i have not been successful.&lt;/P&gt;

&lt;P&gt;thanks in advance.&lt;/P&gt;

&lt;P&gt;James M &lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 12:50:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Return-host-name-in-search-even-if-no-results-are-found/m-p/335586#M99658</guid>
      <dc:creator>jamesmatthews</dc:creator>
      <dc:date>2017-12-11T12:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Return host name in search even if no results are found</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Return-host-name-in-search-even-if-no-results-are-found/m-p/335587#M99659</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Can you please try this search?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex  | eval flag=if(sourcetype="mysourcetype",1,0)  | stats sum(flag) as count by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 13:42:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Return-host-name-in-search-even-if-no-results-are-found/m-p/335587#M99659</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-12-11T13:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: Return host name in search even if no results are found</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Return-host-name-in-search-even-if-no-results-are-found/m-p/335588#M99660</link>
      <description>&lt;P&gt;Hi @jamesmatthews,&lt;/P&gt;

&lt;P&gt;Query which is provided by @kamlesh_vaghela will work when &lt;CODE&gt;host&lt;/CODE&gt; is ingesting data into &lt;CODE&gt;myindex&lt;/CODE&gt; in set time frame for other sourcetype not &lt;CODE&gt;mysourcetype&lt;/CODE&gt;. Let's say &lt;CODE&gt;host&lt;/CODE&gt; is ingesting in &lt;CODE&gt;myindex&lt;/CODE&gt; index for only &lt;CODE&gt;mysourcetype&lt;/CODE&gt; sourcetype in that case you can create lookup table with hostname for which you want to check whether those hosts are sending data to &lt;CODE&gt;myindex&lt;/CODE&gt; or not for sourcetype &lt;CODE&gt;mysourcetype&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Let's say you have lookup file &lt;CODE&gt;hostnames.csv&lt;/CODE&gt; with column header &lt;CODE&gt;hostname&lt;/CODE&gt;, in that case you can try below query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup hostnames.csv | fields hostname | rename hostname AS host | join type=outer host [ search index=myindex sourcetype="mysourcetype" | stats count by host ] | where isnull(count)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Dec 2017 14:21:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Return-host-name-in-search-even-if-no-results-are-found/m-p/335588#M99660</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2017-12-11T14:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Return host name in search even if no results are found</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Return-host-name-in-search-even-if-no-results-are-found/m-p/335589#M99661</link>
      <description>&lt;P&gt;Hi jamesmatthews,&lt;BR /&gt;
the easiest way is to create a lookup (e.g. called perimeter.csv) containing all the hosts in your perimeter (one column called "host") and then run a search like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex sourcetype="mysourcetype" 
| eval host=upper(host)
| stats count BY host
| append [  | inputlookup perimeter.csv | eval host=upper(host), count=0 | fields host count ]
| stats sum(count) AS Total BY host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this way hosts with Total=0 are the missed ones, instead hosts with Total&amp;gt;0 are OK.&lt;/P&gt;

&lt;P&gt;You can show host situation in a dashboard alche in graphic mode.&lt;BR /&gt;
You can also create an alert when Total=0 so you immediately know when there's a problem.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 14:30:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Return-host-name-in-search-even-if-no-results-are-found/m-p/335589#M99661</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-12-11T14:30:35Z</dc:date>
    </item>
  </channel>
</rss>

