Alerting

How to trigger alert when there is switch between events for the first time?

paragg
Loves-to-Learn Lots

I want to get an alert when there is switch between events for the first time. Below is the example for this. 

index=abc sourcetype=xyz  <warning>

index=abc sourcetype=xyz  <critical>


These 2 queries I have and I want an alert when there is switch between from <warning> to <critical>.

Please help with the query.

Labels (1)
0 Karma

bowesmana
SplunkTrust
SplunkTrust

You should look at using streamstats - here's an example that creates 10 events where every 4th event changes from warning to critical.

| makeresults count=10
| streamstats c
| eval _time=now() - c
| eval type=if(c % 4 = 0, "critical", "warning")
| fields - c
| sort - _time
| streamstats count reset_after="("type=\"warning\"")" by type
| where count=1 AND type="critical"

To give you an exact solution would need to know more about your requirement.

This will give 2 results when the type changes to critical from warning

0 Karma
Get Updates on the Splunk Community!

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...

Get ready to show some Splunk Certification swagger at .conf24!

Dive into the deep end of data by earning a Splunk Certification at .conf24. We're enticing you again this ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Now On-Demand Join us to learn more about how you can leverage Service Level Objectives (SLOs) and the new ...