Alerting

Email Alert With Sub-Searches, Comparing Sub-Search Results

torndorff
Explorer

I’m attempting to write an alert that fetches full event data while also comparing the counts of 2 other searches. The idea being that if C1 is greater than or equal to C2, an alert is fired with an email alert action, attaching the events so that business users can receive check it from their phone.

This is the best I could come up with but it doesnt work. Anyone out there able to lend a hand?

index=main loglevel=ERROR | stats
count by _raw | appendcols
[ search index=main loglevel=WARN
| stats count(convId) AS C1 ] | appendcols
[ search index=main loglevel=ERROR
| stats count(convId) AS C2]
| where C1 >= C2

Tags (1)
0 Karma
1 Solution

woodcock
Esteemed Legend

Just add | filldown C1 C2 before the where clause; this worked for me:

index=_* | stats count BY sourcetype 
| appendcols 
    [| makeresults 
    | eval C1=30 | table C1] 
| appendcols 
    [| makeresults 
    | eval C2=20 | table C2]
| filldown C1 C2
| where C1>=C2

View solution in original post

woodcock
Esteemed Legend

Just add | filldown C1 C2 before the where clause; this worked for me:

index=_* | stats count BY sourcetype 
| appendcols 
    [| makeresults 
    | eval C1=30 | table C1] 
| appendcols 
    [| makeresults 
    | eval C2=20 | table C2]
| filldown C1 C2
| where C1>=C2

torndorff
Explorer

Thanks! filldown is a new one for me.

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...