<?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 Alert if no events seen in X hours in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Alert-if-no-events-seen-in-X-hours/m-p/92379#M1295</link>
    <description>&lt;P&gt;Using the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|metadata type=hosts |sort lastTime|convert ctime(lastTime)|fields host,lastTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am able to get a list of all hosts and when the last time splunk saw an event from that host.  What I would like to do is create a saved search based off of this sort of search that I can use as an alert if lastTime is greater than some number of hours for any particular host.  I was imagining something along the lines of&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|metadata type=hosts |sort lastTime|convert ctime(lastTime)|fields host,lastTime |where NOW - lastTime &amp;gt; 12h
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or something along those lines.  Is there a function that would give me NOW (current date/time) and if so, is this the right approach to get what I'm after?&lt;/P&gt;</description>
    <pubDate>Fri, 29 Apr 2011 18:24:53 GMT</pubDate>
    <dc:creator>chadroberts</dc:creator>
    <dc:date>2011-04-29T18:24:53Z</dc:date>
    <item>
      <title>Alert if no events seen in X hours</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-if-no-events-seen-in-X-hours/m-p/92379#M1295</link>
      <description>&lt;P&gt;Using the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|metadata type=hosts |sort lastTime|convert ctime(lastTime)|fields host,lastTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am able to get a list of all hosts and when the last time splunk saw an event from that host.  What I would like to do is create a saved search based off of this sort of search that I can use as an alert if lastTime is greater than some number of hours for any particular host.  I was imagining something along the lines of&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|metadata type=hosts |sort lastTime|convert ctime(lastTime)|fields host,lastTime |where NOW - lastTime &amp;gt; 12h
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or something along those lines.  Is there a function that would give me NOW (current date/time) and if so, is this the right approach to get what I'm after?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2011 18:24:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-if-no-events-seen-in-X-hours/m-p/92379#M1295</guid>
      <dc:creator>chadroberts</dc:creator>
      <dc:date>2011-04-29T18:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: Alert if no events seen in X hours</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-if-no-events-seen-in-X-hours/m-p/92380#M1296</link>
      <description>&lt;P&gt;You're looking for the now() function in eval. The following search will alert you if there are any hosts that haven't sent any data for more than one hour (3600 seconds)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# compare last event's time to now 
|metadata type=hosts | eval since=now()-lastTime | search since&amp;gt;3600 |...

OR 
# compare indexer's time when last event came to now
|metadata type=hosts | eval since=now()-recentTime| search since&amp;gt;3600 |...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 Apr 2011 19:05:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-if-no-events-seen-in-X-hours/m-p/92380#M1296</guid>
      <dc:creator>Ledion_Bitincka</dc:creator>
      <dc:date>2011-04-29T19:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: Alert if no events seen in X hours</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-if-no-events-seen-in-X-hours/m-p/92381#M1297</link>
      <description>&lt;P&gt;Awesome, exactly what I was looking for.  Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2011 19:14:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-if-no-events-seen-in-X-hours/m-p/92381#M1297</guid>
      <dc:creator>chadroberts</dc:creator>
      <dc:date>2011-04-29T19:14:12Z</dc:date>
    </item>
  </channel>
</rss>

