<?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 Splunk Agent Status by Host in Deployment Architecture</title>
    <link>https://community.splunk.com/t5/Deployment-Architecture/Splunk-Agent-Status-by-Host/m-p/140608#M23068</link>
    <description>&lt;P&gt;Recently, the splunk agent has been down on various servers, and I'd like to set up an alert that tells us which servers are in a "DOWN" state once splunk stops running.  I've created this search based on other questions that have been asked here:&lt;/P&gt;

&lt;P&gt;| metadata index=esb_prf type=hosts | append [metadata index=esb_dev type=hosts]&lt;BR /&gt;
| eval host = replace(host,".gtg.com","")&lt;BR /&gt;
| stats max(lastTime) AS last_time_active by host&lt;BR /&gt;
| eval age = now() - last_time_active &lt;BR /&gt;
| eval Status= case(age &amp;lt; 60,"Running",age &amp;gt; 60,"DOWN")&lt;BR /&gt;
| convert ctime(last_time_active) &lt;BR /&gt;
| search Status="DOWN"&lt;BR /&gt;
| table host, last_time_active , Status&lt;BR /&gt;
| sort host&lt;/P&gt;

&lt;P&gt;The problem I'm seeing is that not every host that lists in the table is actually "DOWN", but some of them are.&lt;/P&gt;

&lt;P&gt;Is there a way to modify this search to make it more accurate, and only show servers that are actually down?  I've seen people use "index=_internal", but that is related to throughput of the Forwarder sending data.  So if the Forwarder was up, but had no logs to send, you might get some false reports.  This would probably be really rare, though.  Another thing is searching _internal can be &lt;EM&gt;really&lt;/EM&gt; slow because of all the stuff that gets crammed in there – especially in production.&lt;/P&gt;

&lt;P&gt;Your help would be much appreciated.&lt;/P&gt;

&lt;P&gt;Thank You&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 15:49:07 GMT</pubDate>
    <dc:creator>_gkollias</dc:creator>
    <dc:date>2020-09-28T15:49:07Z</dc:date>
    <item>
      <title>Splunk Agent Status by Host</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Splunk-Agent-Status-by-Host/m-p/140608#M23068</link>
      <description>&lt;P&gt;Recently, the splunk agent has been down on various servers, and I'd like to set up an alert that tells us which servers are in a "DOWN" state once splunk stops running.  I've created this search based on other questions that have been asked here:&lt;/P&gt;

&lt;P&gt;| metadata index=esb_prf type=hosts | append [metadata index=esb_dev type=hosts]&lt;BR /&gt;
| eval host = replace(host,".gtg.com","")&lt;BR /&gt;
| stats max(lastTime) AS last_time_active by host&lt;BR /&gt;
| eval age = now() - last_time_active &lt;BR /&gt;
| eval Status= case(age &amp;lt; 60,"Running",age &amp;gt; 60,"DOWN")&lt;BR /&gt;
| convert ctime(last_time_active) &lt;BR /&gt;
| search Status="DOWN"&lt;BR /&gt;
| table host, last_time_active , Status&lt;BR /&gt;
| sort host&lt;/P&gt;

&lt;P&gt;The problem I'm seeing is that not every host that lists in the table is actually "DOWN", but some of them are.&lt;/P&gt;

&lt;P&gt;Is there a way to modify this search to make it more accurate, and only show servers that are actually down?  I've seen people use "index=_internal", but that is related to throughput of the Forwarder sending data.  So if the Forwarder was up, but had no logs to send, you might get some false reports.  This would probably be really rare, though.  Another thing is searching _internal can be &lt;EM&gt;really&lt;/EM&gt; slow because of all the stuff that gets crammed in there – especially in production.&lt;/P&gt;

&lt;P&gt;Your help would be much appreciated.&lt;/P&gt;

&lt;P&gt;Thank You&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:49:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Splunk-Agent-Status-by-Host/m-p/140608#M23068</guid>
      <dc:creator>_gkollias</dc:creator>
      <dc:date>2020-09-28T15:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Agent Status by Host</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Splunk-Agent-Status-by-Host/m-p/140609#M23069</link>
      <description>&lt;P&gt;Increase the age limit that you are checking. 60 sec may be very low and with some latencies, you may get false calls. Set it to a value like 5 min (300) or 30 min (1800).&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2014 20:33:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Splunk-Agent-Status-by-Host/m-p/140609#M23069</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-02-06T20:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Agent Status by Host</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Splunk-Agent-Status-by-Host/m-p/140610#M23070</link>
      <description>&lt;P&gt;Thanks for the response.&lt;/P&gt;

&lt;P&gt;I tried that and it just narrowed down the results from 32 to 23.  A lot of the same servers that aren't really down are still showing up in the results.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2014 20:36:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Splunk-Agent-Status-by-Host/m-p/140610#M23070</guid>
      <dc:creator>_gkollias</dc:creator>
      <dc:date>2014-02-06T20:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Agent Status by Host</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Splunk-Agent-Status-by-Host/m-p/140611#M23071</link>
      <description>&lt;P&gt;The fastest execution is probably to query the deployment server's client list like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /services/deployment/server/clients
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You'll get a list of deployment clients back, along with a timestamp of their latest phonehome request. Based on your phonehome intervals you can then determine deployment clients that should have phoned home but didn't. Something along these lines:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /services/deployment/server/clients | where lastPhoneHomeTime &amp;lt; relative_time(now(), "-10m")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Adjust the "-10m" accordingly. Can't test that myself right now, just give it a shot.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2014 20:43:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Splunk-Agent-Status-by-Host/m-p/140611#M23071</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-02-06T20:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Agent Status by Host</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Splunk-Agent-Status-by-Host/m-p/140613#M23073</link>
      <description>&lt;P&gt;That should do all the filtering already, based on the current time and their last phonehome time. You can append the &lt;CODE&gt;table&lt;/CODE&gt; and &lt;CODE&gt;sort&lt;/CODE&gt; of course, if you like.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2014 21:03:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Splunk-Agent-Status-by-Host/m-p/140613#M23073</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-02-06T21:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Agent Status by Host</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Splunk-Agent-Status-by-Host/m-p/140614#M23074</link>
      <description>&lt;P&gt;hmmm...I'm not getting any results with that. I'll keep playing around with it.  If you have any other suggestions I'm all ears.  Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2014 21:16:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Splunk-Agent-Status-by-Host/m-p/140614#M23074</guid>
      <dc:creator>_gkollias</dc:creator>
      <dc:date>2014-02-06T21:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Agent Status by Host</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Splunk-Agent-Status-by-Host/m-p/140615#M23075</link>
      <description>&lt;P&gt;Are you running that on the deployment server?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2014 21:19:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Splunk-Agent-Status-by-Host/m-p/140615#M23075</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-02-06T21:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Agent Status by Host</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Splunk-Agent-Status-by-Host/m-p/140616#M23076</link>
      <description>&lt;P&gt;I'm using a two step process to various ends. Step 1 is get the most recent timestamp for every host, sourcetype, and source - write that to a csv. Step 2 is evaluate that list to alert if a host or particular sourcetype or source hasn't been seen in X period of time.&lt;/P&gt;

&lt;P&gt;Build Query&lt;BR /&gt;&lt;BR /&gt;
    | metasearch | rex field=host "(?&lt;HOST&gt;^[^0-9]\S[^.]+)|(^[0-9]\S+)" | eval host = lower(host) | dedup index host sourcetype source | rex field=source "(?&lt;PATH&gt;.*?)(?:.[^./]+?)?$" | eval last_seen = _time | table index host sourcetype path last_seen | inputlookup append=t host_data_last_seen.csv | stats max(last_seen) AS last_seen by index host sourcetype path | eval right_now = now() | eval time_diff = right_now - last_seen | where time_diff &amp;lt; (86400 * 4) | table index host sourcetype path last_seen | outputlookup host_data_last_seen.csv&lt;/PATH&gt;&lt;/HOST&gt;&lt;/P&gt;

&lt;P&gt;Couple notes:&lt;BR /&gt;&lt;BR /&gt;
I have some FQ host names and some that aren't. Am making them all short. I also have a lot of sources that have dates at the end for log rotation. The second rex command deals with that (gracefully for the most part). Adjust the where statement for the number of days you keep data from systems that stop sending logs. In this case I figure if data hasn't come in after 4 days then it is probably decommissioned. I used dedup as it was faster than using stats to the same ends (1,300 forwarders / 1.5TB)&lt;/P&gt;

&lt;P&gt;Alert  Query&lt;BR /&gt;&lt;BR /&gt;
    | inputlookup host_data_last_seen.csv | stats max(last_seen) as last_seen by host | eval right_now = now() | eval time_diff = right_now - last_seen | eval hours = round(time_diff/3600) | where hours &amp;gt;= 8 | eval alert = "Hours since logs last seen - " .hours | table host alert hours | sort -hours | fields host alert&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:49:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Splunk-Agent-Status-by-Host/m-p/140616#M23076</guid>
      <dc:creator>Runals</dc:creator>
      <dc:date>2020-09-28T15:49:30Z</dc:date>
    </item>
  </channel>
</rss>

