Alerting

How to log the alert name and the date/time the alert was triggered to a log file, not the actual search results?

mookiie2005
Communicator

I want to create a way to log the alert name and trigger time to a log file and retain that information for 6 months - not the actual search results, just the name of the alert and time/date it was triggered. Has anyone done this before? You can save the search results and set a custom retention time for that, but in our case we don't want the search results, just the log of the alert trigger time. Please let us know if anyone has done something like this before or has an idea how to do it.

Thanks,
Sean

0 Karma

woodcock
Esteemed Legend

Start with this search, which creates a report of the currently active alerts, and refine from there:

index=_audit action=alert_fired | eval ttl=expiration-now() | search ttl>0 | convert ctime(trigger_time) | table trigger_time ss_name severity

You can also do it with the REST API starting here:

| rest /servicesNS/-/-/saved/searches

https://answers.splunk.com/answers/146985/how-to-view-list-of-email-addresses-for-saved-alerts.html
http://docs.splunk.com/Documentation/Splunk/6.2.3/RESTREF/RESTsearch
http://docs.splunk.com/Documentation/Splunk/6.2.3/RESTREF/RESTsearchExamples

0 Karma

mookiie2005
Communicator

This does not help at all? Splunk is only retaining the alerts for however long you have set them to be retained. We do not want to retain the results of every alert perpetually so they are still on the _audit index. What I need is a way to log alert triggers to a separate index where we can maintain the alert name, and alert time it triggered. Anyone have a practical way to do this?

0 Karma
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...