Alerting

Looking for solution of one alert calling script to execute second saved search

burwell
SplunkTrust
SplunkTrust

We want to do a search every minute on some logs. We want to identify those hosts whose events have http_code=5xx more than one percent of the time. And we want to see the actual events.

What I envisioned was one alert that would count the total events, count the 5xx events and when 5xx/total > 1% would alert and call a script that would perform a second search on the very same time event and show us the hosts and events that are involved.

We tried various things including evenstats, but it is too slow trying to do this in one search every minute. The search took too long.

I'm looking for a script called by search1 where I can call a named saved search2 with earliest/latest that I get from search1 and then have it alert.

Or maybe this is too complicated and there is a simpler way to go about this. Thanks!

0 Karma
1 Solution

dolivasoh
Contributor

Do you need to see all the events containing a 5xx error or would a sample do? if so, experiment with something like

| stats latest(_raw) as sample_event

If that's no good, I might suggest using a subsearch with append or appendcols

View solution in original post

burwell
SplunkTrust
SplunkTrust

If you answer the question I can then accept the answer...

0 Karma

dolivasoh
Contributor

Do you need to see all the events containing a 5xx error or would a sample do? if so, experiment with something like

| stats latest(_raw) as sample_event

If that's no good, I might suggest using a subsearch with append or appendcols

burwell
SplunkTrust
SplunkTrust

subsearch is the solution for me. I had never really used it before. That is exactly what I wanted. Thanks!

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...