Alerting

How do you make an alert that doesn't trigger when condition goes true?

abdulwsu
New Member

I have an alert to send us an email every time an app on the server is stopped. I am searching for a stopped pattern and generating the alert. However, there are times when we manually stop this app for maintenance and start it back up after the work is done. Now, this would generate a false alert since the app is stopped.

Is there anyway to avoid this? I mean, i only want to get alerted when the app is stopped and not restarted.

Here's an example:

I stop the app for maintenance at 1.00 PM. A app is stopped error is logged in the logs. I start it back at 1.10.

After multiple different lines in the logs, starting flow message is logged. However, in my current alert, since it's stopped in logged, i get alerted even though I have started the app back up. I am trying to avoid that.

My logs when the app is stopped has this line(my current search pattern).

Cannot process event as "app" is stopped
Multiple lines of different texts and words.....
Starting flow: app

So I should only get alerted if the starting flow line is not present in the logs in the set time period.

0 Karma

kmaron
Motivator

You might have to tweak this a bit depending on if you want to use host or not but maybe this will help.

index=foo sourcetype=bar ... ("Cannot process event as "app" is stopped" OR "Starting flow: app") 
 | streamstats count(eval(like(_raw, "Cannot process event as "app" is stopped") OR like(_raw, "Starting flow: app")) AS counts BY host
 | stats range(_time) AS downTimeSeconds count AS messages values(_time) as Time by host
 | eval now=now()
 | eval downTimeSeconds = if((messages<2), now - Time, downTimeSeconds)
 | where downTimeSeconds > 180
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Observability Simplified: Combining User Experience, Application Performance & ...

Tech Talk Observability Simplified: Combining User Experience, Application Performance & Network ...

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...