Alerting

Alert or Show when a host is down from any index

jaywilwk
Engager

I have multiple indexes that I would like to look across all of them see when a host stops sending logs or down within a 24 hour window.

0 Karma

kristian_kolb
Ultra Champion

Or you can look at the metadata to see when a host last sent some data. The example below lists hosts that have not sent data in the last day (86400 seconds). Should be significantly quicker than searching through the metrics logs.

| metadata type=hosts |where recentTime < now() - 86400 | eval lastSeen = strftime(recentTime, "%F %T") | fields + host lastSeen

/K

jaywilwk
Engager

Yes it worked.

0 Karma

kristian_kolb
Ultra Champion

well, yes, that is the purpose of the where statement in the original query. However, does lastSeen for your 'missing' host seem correct?

0 Karma

jaywilwk
Engager

Ok, this one shows everything. It doesn't just show ones that are not loggin or down. Is it possible to show only the ones that are down or not logging.

0 Karma

kristian_kolb
Ultra Champion

Ok.

| metadata type=hosts | eval lastSeen = strftime(recentTime, "%F %T") | fields + host lastSeen

?

0 Karma

jaywilwk
Engager

It shows with only the first part, but not with the rest.

0 Karma

kristian_kolb
Ultra Champion

does it show with only the first part?

| metadata type=hosts

/K

0 Karma

jaywilwk
Engager

This worked fine, but it left out some host. There's a host that's not showing that I know isn't reporting. Hasn't been reporting for over 3 days now.

0 Karma

somesoni2
SplunkTrust
SplunkTrust

All the hosts (whether they are sending data or not) send heartbeat to indexer in _internal index. you can query that to identify if a host is down or not.

index=_internal source=*metrics.log group=tcpin_connections earliest=-7d@d
| eval sourceHost=coalesce(hostname, sourceHost)
| eval age = (now() - _time )
|stats first(age) as age, first(_time) as LastTime by sourceHost
| convert ctime(LastTime) as "Last Active On"
| eval Status= case(age < XXX,"Running",age > XXX,"DOWN")

Where XXX=duration in second for which is their are no heartbeat from host, the host is down. Typically is can be 2-3 min (120 or 180)

somesoni2
SplunkTrust
SplunkTrust

Did it show the host before you put it down (with same search)? The query depends on existence of fields hostname OR sourceHost from the events from that host (its used in stats so if either of the field is null they won't show up.

0 Karma

splunker9999
Path Finder

@somesoni2, do we to run your search on Indexer? When I tried running this on one of my search head, I was getting status of my splunk servers but not forwarders?

0 Karma

thelen_m_kevin
New Member

I know this is a bit dated, but I was interested in finding hosts that "suddenly stop reporting to splunk" and I found this answer.

When I run this search everything looks fine, and it makes sense. But I decided to test this by issuing a stop command on one of my forwarding agents. That device no longer shows up in the list at all instead of showing up with a "down" status.

Can anyone take a stab at why that would happen? (I haven't altered the search except to add seconds where there are XXX's)

0 Karma

jaywilwk
Engager

I tried this search out and wasn't able to yield any results. I tried changing the XXX to differents seconds and still didn't yield any results.

0 Karma
Get Updates on the Splunk Community!

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...