<?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: alert if field missing over x mins in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/alert-if-field-missing-over-x-mins/m-p/332674#M5894</link>
    <description>&lt;P&gt;Hi stephenmoorhouse,&lt;BR /&gt;
I suggest to you to insert your hosts list in a lookup (e.g. perimeter.csv) and then use this lookup for serching the missed ones, note that for only 4 host isn't mandatory to use a lookup, you could insert them in your search (host=host1 OR host=host2 OR host=host3 OR host=host4), but it's a best practice!&lt;BR /&gt;
Every way try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex sourcetype=mysourcetype earliest=-5m 
| eval count=0, host=upper(host) 
| append [ | inputlookup perimeter.csv | eval host=upper(host) | stats count by host ]
| stats sum(count) AS Total by host
| where Total=0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this way you have all hosts that didn't send logs in the last 5 minutes.&lt;/P&gt;

&lt;P&gt;You can use it in an alert scheduled every 5 minutes or, without the last row, in a dashboard panel to show all monitored hosts, highlighting the missed ones.&lt;BR /&gt;
You can also show this panel in a table with coloured icons.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Tue, 18 Apr 2017 10:17:33 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2017-04-18T10:17:33Z</dc:date>
    <item>
      <title>alert if field missing over x mins</title>
      <link>https://community.splunk.com/t5/Alerting/alert-if-field-missing-over-x-mins/m-p/332673#M5893</link>
      <description>&lt;P&gt;Hi, for a given index and sourcetype I have a field called host which can be one of 4 values &lt;BR /&gt;
There normally several log-lines for each host every minute&lt;BR /&gt;
I would like an alert if one of the hosts stops logging for say 5 minutes&lt;/P&gt;

&lt;P&gt;I have&lt;BR /&gt;
index=myindex sourcetype=mysourcetype earliest=-5m | stats count by host&lt;/P&gt;

&lt;P&gt;and the alert to trigger if the value is 0 - but if one of the hosts is no in the logs - you get&lt;BR /&gt;
host count&lt;BR /&gt;
host-a 128&lt;BR /&gt;
host-b 143&lt;BR /&gt;
host-d 122  &lt;/P&gt;

&lt;P&gt;and host-c is missing rather than 0 so nothing triggers &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; &lt;/P&gt;

&lt;P&gt;any ideas other than 4 separate alerts?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 09:57:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/alert-if-field-missing-over-x-mins/m-p/332673#M5893</guid>
      <dc:creator>stephenmoorhous</dc:creator>
      <dc:date>2017-04-18T09:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: alert if field missing over x mins</title>
      <link>https://community.splunk.com/t5/Alerting/alert-if-field-missing-over-x-mins/m-p/332674#M5894</link>
      <description>&lt;P&gt;Hi stephenmoorhouse,&lt;BR /&gt;
I suggest to you to insert your hosts list in a lookup (e.g. perimeter.csv) and then use this lookup for serching the missed ones, note that for only 4 host isn't mandatory to use a lookup, you could insert them in your search (host=host1 OR host=host2 OR host=host3 OR host=host4), but it's a best practice!&lt;BR /&gt;
Every way try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex sourcetype=mysourcetype earliest=-5m 
| eval count=0, host=upper(host) 
| append [ | inputlookup perimeter.csv | eval host=upper(host) | stats count by host ]
| stats sum(count) AS Total by host
| where Total=0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this way you have all hosts that didn't send logs in the last 5 minutes.&lt;/P&gt;

&lt;P&gt;You can use it in an alert scheduled every 5 minutes or, without the last row, in a dashboard panel to show all monitored hosts, highlighting the missed ones.&lt;BR /&gt;
You can also show this panel in a table with coloured icons.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 10:17:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/alert-if-field-missing-over-x-mins/m-p/332674#M5894</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-04-18T10:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: alert if field missing over x mins</title>
      <link>https://community.splunk.com/t5/Alerting/alert-if-field-missing-over-x-mins/m-p/332675#M5895</link>
      <description>&lt;P&gt;Can be done in multiple ways. &lt;/P&gt;

&lt;P&gt;Host lookup (have a lookup uploaded with list of hosts)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|inputlookup lookup_hosts.csv|table host | join type=outer host [search index=myindex sourcetype=mysourcetype earliest=-5m | stats count by host ] | search NOT count =*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Increase the time frame. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex sourcetype=mysourcetype earliest=-15m|dedup host |table _time host |where _time  &amp;lt; now() - 300
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;UL&gt;
&lt;LI&gt;Similar to above logic  but consider using either _inernal licence metrics  or tstats command. &lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Tue, 18 Apr 2017 10:28:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/alert-if-field-missing-over-x-mins/m-p/332675#M5895</guid>
      <dc:creator>Ravan</dc:creator>
      <dc:date>2017-04-18T10:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: alert if field missing over x mins</title>
      <link>https://community.splunk.com/t5/Alerting/alert-if-field-missing-over-x-mins/m-p/569836#M13092</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;, im currently stuck with the same issue as this but the difference is I don't use input lookup for my query.&amp;nbsp; I have seen this comment of yours and it is possible to add the host in the search as you say but im not sure how can i add it to this query because im also using the same but im not using host using other field from the event logs Thanks in advance&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 07:51:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/alert-if-field-missing-over-x-mins/m-p/569836#M13092</guid>
      <dc:creator>neilfajardo15</dc:creator>
      <dc:date>2021-10-06T07:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: alert if field missing over x mins</title>
      <link>https://community.splunk.com/t5/Alerting/alert-if-field-missing-over-x-mins/m-p/569838#M13093</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/239272"&gt;@neilfajardo15&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if you have few hosts is possible to insert them in the search, even if I always hint to use the lookup to have a more maintenable object.&lt;/P&gt;&lt;P&gt;so, if you have three hosts, you could run something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| metasearch index=_internal
| eval host=lower(host)
| stats count BY host
| append [ | makeresults | eval host="host1", count=0 | fields host count ]
| append [ | makeresults | eval host="host2", count=0 | fields host count ]
| append [ | makeresults | eval host="host3", count=0 | fields host count ]
| stats sum(count) AS total By host
| where total=0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: next time, please, open a new question.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 08:03:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/alert-if-field-missing-over-x-mins/m-p/569838#M13093</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-10-06T08:03:13Z</dc:date>
    </item>
  </channel>
</rss>

