<?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: Is there a way to check for a file from n number of hosts and alert if there is no file from each host in last 30min? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-check-for-a-file-from-n-number-of-hosts-and/m-p/269910#M81243</link>
    <description>&lt;P&gt;Great! Would mind accepting the answer?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jan 2017 17:27:57 GMT</pubDate>
    <dc:creator>jplumsdaine22</dc:creator>
    <dc:date>2017-01-31T17:27:57Z</dc:date>
    <item>
      <title>Is there a way to check for a file from n number of hosts and alert if there is no file from each host in last 30min?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-check-for-a-file-from-n-number-of-hosts-and/m-p/269905#M81238</link>
      <description>&lt;P&gt;&lt;CODE&gt;index=test File="*.txt" | stats count by host | where count&amp;lt;1&lt;/CODE&gt;  --&amp;gt;with this I am getting NoResults found" but I need count 0 if there is no file from host1 or host2 or host3 or so on and need to show for which host there is no file&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;HostName           count
host1              0
host2              0
host3              0
:
:
hostn              0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Jan 2017 20:56:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-check-for-a-file-from-n-number-of-hosts-and/m-p/269905#M81238</guid>
      <dc:creator>sai_john</dc:creator>
      <dc:date>2017-01-30T20:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to check for a file from n number of hosts and alert if there is no file from each host in last 30min?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-check-for-a-file-from-n-number-of-hosts-and/m-p/269906#M81239</link>
      <description>&lt;P&gt;See answer here: &lt;A href="https://answers.splunk.com/answers/492077/stats-not-returning-zero-counts.html#answer-494838"&gt;https://answers.splunk.com/answers/492077/stats-not-returning-zero-counts.html#answer-494838&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2017 21:02:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-check-for-a-file-from-n-number-of-hosts-and/m-p/269906#M81239</guid>
      <dc:creator>jplumsdaine22</dc:creator>
      <dc:date>2017-01-30T21:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to check for a file from n number of hosts and alert if there is no file from each host in last 30min?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-check-for-a-file-from-n-number-of-hosts-and/m-p/269907#M81240</link>
      <description>&lt;P&gt;The below link gives code for your answer, but here is the explanation - &lt;/P&gt;

&lt;P&gt;When you do "| stats count by host", splunk is adding up all the events that HAVE been received for each host within your time window.  &lt;/P&gt;

&lt;P&gt;There are no records to tell splunk about any hosts that have NOT reported.&lt;/P&gt;

&lt;P&gt;So, you either have to keep a list of which hosts you care about - the first method at the linked answer... and report the ones on the list that aren't in your summary stats...&lt;/P&gt;

&lt;P&gt;OR you have to look at ALL the responses, and see for which hosts the latest event is earlier than your desired half hour window - the second method at the linked answer. &lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2017 22:59:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-check-for-a-file-from-n-number-of-hosts-and/m-p/269907#M81240</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-01-30T22:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to check for a file from n number of hosts and alert if there is no file from each host in last 30min?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-check-for-a-file-from-n-number-of-hosts-and/m-p/269908#M81241</link>
      <description>&lt;P&gt;Hi sai_john,&lt;BR /&gt;
you should create a lookup with all your server to monitor (e.g. Perimeter.csv) and run a search like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup Perimeter.csv 
| eval count=0, host=upper(host)
| append [ search 
   index=_internal
   | host=upper(host)
   | stats count by host
   ]
| stats sum(count) AS Totale by host
| where Total=0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this way all the results with Total=0 are missing and the ones with Total&amp;gt;0 are present.&lt;BR /&gt;
With this search you can run an alert or to shor your infrastructure situation, maybe adding some other commands:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup Perimeter.csv 
| eval count=0, host=upper(host)
| append [ search 
   index=_internal
   | host=upper(host)
   | stats count by host
   ]
| stats sum(count) AS Totale by host
| rangemap field=Somma severe=0-0 low=1-1000000000 default=severe 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can graphically display your situation adding to your app two files ($SPLUNK_HOME/etc/apps/your_app/appserver/static:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;table_icons_rangemap5.js;&lt;/LI&gt;
&lt;LI&gt;table_decorations2.css&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;(you can take them from the Splunk Dashboard Examples App (&lt;A href="https://splunkbase.splunk.com/app/1603/" target="_blank"&gt;https://splunkbase.splunk.com/app/1603/&lt;/A&gt;).&lt;/P&gt;

&lt;P&gt;and adding to your dashboard the first row&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form script="table_icons_rangemap.js" stylesheet="table_decorations.css"&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:54:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-check-for-a-file-from-n-number-of-hosts-and/m-p/269908#M81241</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-09-30T02:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to check for a file from n number of hosts and alert if there is no file from each host in last 30min?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-check-for-a-file-from-n-number-of-hosts-and/m-p/269909#M81242</link>
      <description>&lt;P&gt;@jplumsdaine22 your tstats worked for me after little modifications.Thanks&lt;BR /&gt;
Your Search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats earliest=-30d count WHERE index=xxx by host 
 | fields host 
 | join type=left host [ 
   search index=xxx earliest=-60m
  | bucket _time span=3m 
   | stats count by _time host IP
   ] 
 | fillnull count value=0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Modified search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats  count WHERE index=xxx earliest=-1h by _time host 
 | fields host 
 | join type=left host [ 
   search index=xxx earliest=-60m
  | bucket _time span=3m 
   | stats count by _time host IP
   ] 
 | fillnull count value=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Jan 2017 16:59:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-check-for-a-file-from-n-number-of-hosts-and/m-p/269909#M81242</guid>
      <dc:creator>sai_john</dc:creator>
      <dc:date>2017-01-31T16:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to check for a file from n number of hosts and alert if there is no file from each host in last 30min?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-check-for-a-file-from-n-number-of-hosts-and/m-p/269910#M81243</link>
      <description>&lt;P&gt;Great! Would mind accepting the answer?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 17:27:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-check-for-a-file-from-n-number-of-hosts-and/m-p/269910#M81243</guid>
      <dc:creator>jplumsdaine22</dc:creator>
      <dc:date>2017-01-31T17:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to check for a file from n number of hosts and alert if there is no file from each host in last 30min?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-check-for-a-file-from-n-number-of-hosts-and/m-p/269911#M81244</link>
      <description>&lt;P&gt;Sorry i am too early to accept this, I haven't recognized that this search which I am getting count for field "File" is not getting correct values.&lt;/P&gt;

&lt;P&gt;Here is my search for alerting if there is no ".txt" File in last 1hr either from host1 or host2&lt;/P&gt;

&lt;P&gt;| tstats  count WHERE index=xxx earliest=-1h by _time host &lt;BR /&gt;
  | fields _time host &lt;BR /&gt;
  | join type=left host [ &lt;BR /&gt;
    search index=xxx (host=host1 OR host=host2) sourcetype=abc File="*.txt" &lt;BR /&gt;
       | stats count by _time host File&lt;BR /&gt;
    ] &lt;BR /&gt;
  | fillnull count value=0 | where count=0&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 18:00:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-check-for-a-file-from-n-number-of-hosts-and/m-p/269911#M81244</guid>
      <dc:creator>sai_john</dc:creator>
      <dc:date>2017-02-01T18:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to check for a file from n number of hosts and alert if there is no file from each host in last 30min?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-check-for-a-file-from-n-number-of-hosts-and/m-p/269912#M81245</link>
      <description>&lt;P&gt;try something like this, &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=test File="*.txt" | stats count by host| search count&amp;gt;0 | append [|stats count | eval host="host1"] | append [|stats count | eval host="host2"] | stats max(count) as count  by host | where count=0 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will help you for two host, in-case of multiple host you have to go with lookup to keep the list of host and change the second where condition (where n_records=2) as number of host you have. &lt;/P&gt;

&lt;P&gt;Hope this will helps you. &lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 01:24:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-check-for-a-file-from-n-number-of-hosts-and/m-p/269912#M81245</guid>
      <dc:creator>mpreddy</dc:creator>
      <dc:date>2017-02-02T01:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to check for a file from n number of hosts and alert if there is no file from each host in last 30min?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-check-for-a-file-from-n-number-of-hosts-and/m-p/269913#M81246</link>
      <description>&lt;P&gt;@mpreddy&lt;BR /&gt;&lt;BR /&gt;
This is working for me. Thankyou&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 02:24:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-check-for-a-file-from-n-number-of-hosts-and/m-p/269913#M81246</guid>
      <dc:creator>sai_john</dc:creator>
      <dc:date>2017-02-02T02:24:32Z</dc:date>
    </item>
  </channel>
</rss>

