<?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: Use inputlookup to find servers not reporting in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310382#M93096</link>
    <description>&lt;P&gt;^ updated ... I left out the key fact that I'm looking for a specific term, not being logged on the other servers, and using the inputlookup as my master list. So I need to find all hosts in a specific environment, that do not contain "search_request" in their logs. My host logs do not have "environment", only index | host as configured fields.&lt;/P&gt;</description>
    <pubDate>Tue, 04 Apr 2017 23:04:24 GMT</pubDate>
    <dc:creator>hippe21</dc:creator>
    <dc:date>2017-04-04T23:04:24Z</dc:date>
    <item>
      <title>Use inputlookup to find servers not reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310378#M93092</link>
      <description>&lt;P&gt;Here's the scenario: server102 has not reported data in the last 15 minutes. I want to use my inputlookup in conjunction with a subsearch, to show server102 in my search results, as it did not report data (and also setup an alert based on this).&lt;/P&gt;

&lt;P&gt;My inputlookup contains the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;environment,host
dev,server001
dev,server002
prod,server101
prod,server102
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Using the following search, I'm getting all of the hosts returned. I only want my prod server102 to return in my results, since the log entry has not shown up on that host.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|  inputlookup myserverlist.csv | search environment=prod NOT [search index=my_index "search_request" ] | dedup host | fields host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Do I need to have some matching field (other than host) between the csv file, and the server logs? Server logs contain [index | host] but NOT environment. Could this be why? &lt;/P&gt;

&lt;P&gt;** updated - I'm using the inputlookup to keep track of which hosts belong to which environment, and want that list (in my case all prod servers &amp;gt; environment=prod), to search for all prod hosts that do NOT have "search_request" in their logs.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 20:59:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310378#M93092</guid>
      <dc:creator>hippe21</dc:creator>
      <dc:date>2017-04-04T20:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: Use inputlookup to find servers not reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310379#M93093</link>
      <description>&lt;P&gt;hippe21,&lt;/P&gt;

&lt;P&gt;You can use a subsearch to accomplish this:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;|inputlookup test1.csv | search NOT [search index=_internal |dedup host | table host]&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;This search will take your CSV and elemenate hosts found in the subsearch. The results in your case woulkd be a table with:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;environment,host&lt;BR /&gt;
prod,server102&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Obliviously, modify the subsearch and CSV names to suit your environment. &lt;/P&gt;

&lt;P&gt;If you'd like to look at your data as the only indicator, i'd recommend | tstats:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;| tstats count, latest(_time) AS last_seen where index=* by sourcetype,host | eval timeDiff=now()-last_seen | search timeDiff&amp;gt;900&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Change "900" to how long you'd like to consider something missing in seconds. | tstats is going to be significantly faster than | metadata.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:32:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310379#M93093</guid>
      <dc:creator>beatus</dc:creator>
      <dc:date>2020-09-29T13:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: Use inputlookup to find servers not reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310380#M93094</link>
      <description>&lt;P&gt;@hippe21... You dont need a lookup file if you want to monitor hosts for events...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | metadata type=hosts index=&amp;lt;YourIndexName&amp;gt;
 | eval lastDataDuration=(now()-lastTime)/60
 | where lastDataDuration&amp;gt;15
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should report all hosts that have not pushed an event in last 15 min. Refer to Splunk documentation &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Metadata"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Metadata&lt;/A&gt; and my recent answer on similar question &lt;A href="https://answers.splunk.com/answers/515455/alert-for-lack-of-conent-for-one-host.html#answer-515460"&gt;https://answers.splunk.com/answers/515455/alert-for-lack-of-conent-for-one-host.html#answer-515460&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 21:45:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310380#M93094</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-04-04T21:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: Use inputlookup to find servers not reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310381#M93095</link>
      <description>&lt;P&gt;I agree with @nikenilay but if you &lt;EM&gt;really&lt;/EM&gt; want to cover the bases, you will do &lt;EM&gt;both&lt;/EM&gt; like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metadata type=hosts index=&amp;lt;YourIndexName&amp;gt;
| appendpipe [|inputlookup myserverlist.csv | eval lastTime = 0]
| dedup host
| eval lastDataDuration=(now()-lastTime)/60
| where lastDataDuration&amp;gt;15
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Apr 2017 22:23:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310381#M93095</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-04-04T22:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: Use inputlookup to find servers not reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310382#M93096</link>
      <description>&lt;P&gt;^ updated ... I left out the key fact that I'm looking for a specific term, not being logged on the other servers, and using the inputlookup as my master list. So I need to find all hosts in a specific environment, that do not contain "search_request" in their logs. My host logs do not have "environment", only index | host as configured fields.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 23:04:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310382#M93096</guid>
      <dc:creator>hippe21</dc:creator>
      <dc:date>2017-04-04T23:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: Use inputlookup to find servers not reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310383#M93097</link>
      <description>&lt;P&gt;You'd probably be best off with something like this then:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;|inputlookup test1.csv | search NOT [search index=my_index search_request|dedup host | table host]&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;That will show any hosts in your lookup table that do not contain the term in the subsearch. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:32:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310383#M93097</guid>
      <dc:creator>beatus</dc:creator>
      <dc:date>2020-09-29T13:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: Use inputlookup to find servers not reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310384#M93098</link>
      <description>&lt;P&gt;That's bizarre, I've tried this, and for whatever reason all my hosts are returning. I want to specifically choose the environment (based on 'myserverlist.csv' environment column), and then from there, find all hosts within that environment that do not have "search_request". This query returns ALL hosts in my csv:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|  inputlookup myserverlist.csv | search environment=prod NOT [search index=my_index "search_request" ] | dedup host | fields host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Apr 2017 23:12:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310384#M93098</guid>
      <dc:creator>hippe21</dc:creator>
      <dc:date>2017-04-04T23:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: Use inputlookup to find servers not reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310385#M93099</link>
      <description>&lt;P&gt;Ahh, that's why, I was using  | dedup host | fields host and not |dedup host | table host #derp &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 23:26:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310385#M93099</guid>
      <dc:creator>hippe21</dc:creator>
      <dc:date>2017-04-04T23:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: Use inputlookup to find servers not reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310386#M93100</link>
      <description>&lt;P&gt;Glad you got it!&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 23:27:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310386#M93100</guid>
      <dc:creator>beatus</dc:creator>
      <dc:date>2017-04-04T23:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Use inputlookup to find servers not reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310387#M93101</link>
      <description>&lt;P&gt;What you want is a sentinel lookup. Not using subsearch on the logs.  It might work at low volume. But it will break at scale. &lt;/P&gt;

&lt;P&gt;Make a lookup with two columns. Host and count. Put a zero in the count column for all hosts you want to alert for. &lt;/P&gt;

&lt;P&gt;Then do like this&lt;/P&gt;

&lt;P&gt;| tstats count where index=* by host | append [ | inputlookup mytable] | stats sum(count) as count by host | where count=0&lt;/P&gt;

&lt;P&gt;That will give you all hosts your table says should be logging if no logs are in the search for the time window you ran it over. &lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2017 05:05:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310387#M93101</guid>
      <dc:creator>starcher</dc:creator>
      <dc:date>2017-04-05T05:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Use inputlookup to find servers not reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310388#M93102</link>
      <description>&lt;P&gt;Right, this is pretty much the same thing as my answer but definitely use &lt;CODE&gt;appendpipe&lt;/CODE&gt; over &lt;CODE&gt;append&lt;/CODE&gt; because &lt;CODE&gt;append&lt;/CODE&gt; has subsearch limits (10.5K) but &lt;CODE&gt;appendpipe&lt;/CODE&gt; does not.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2017 14:04:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-inputlookup-to-find-servers-not-reporting/m-p/310388#M93102</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-04-05T14:04:14Z</dc:date>
    </item>
  </channel>
</rss>

