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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...