All Apps and Add-ons

How to create an alert if a switch is disabled for more than 10 min?

pp1231234
Engager

Hi all,

I am currently working on creating an alert to notify if the status of a switch is disable for more than 10 min, common scenario is that switches disconnect for a min and would be back to running, we would only like to target the ones whose status remains disconnected for more than 10 min.

Below is the sample log:

Apr 18 07:46:25 hostname tag=abc CEF:0Agent status changed|Status of agent "name" at IP "ip address" (id=10,0) changed from running to disabled
Apr 11 07:50:10 hostname tag=abc CEF:0Agent status changed|Status of agent "name" at IP "ip address" (id=10,0) changed from disabled to Running
Tags (2)
0 Karma

woodcock
Esteemed Legend

Like this:

...
| rex "changed from (?<transition>.*)"
| streamstats count(eval(transition="disabled to Running")) AS sessionID BY host
| stats first(_time) AS _time count dc(transition) AS transitionCount values(transition) AS transition BY sessionID host
| where transitionCount==1 AND transition="running to disabled" AND _time <= relative_time(now(), "-10m")
0 Karma
Get Updates on the Splunk Community!

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...