Splunk Search

Can a Splunk alert be triggered by comparing the row counts of two searches?

jbrenner
Path Finder

I would like to compare the row count returned from two searches and trigger an alert based on whether search 1 returns more rows than search 2. Is there a way to do this?

Thanks,
Jonathan

0 Karma

aaraneta_splunk
Splunk Employee
Splunk Employee

@jbrenner - Were you able to test out somesoni2's solution? Did it work? If yes, please don't forget to resolve this post by clicking on "Accept". If you still need more help, please provide a comment with some feedback. Thanks!

0 Karma

somesoni2
Revered Legend

Yes, a simple implementation would be like this. More accurate/optimized suggestions if you can share your searches.

search1 | stats count as count1| appendcols [search search2 | stats count as count2] | where count1>count2
0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...