Other Usage

How to use REST API for Alerts

Travis_Stanley
Observer

Hi,  I'm trying to use the REST API to get and post saved searches that are Alerts but for some reason it only returns data for Reports. Has anyone else had this problem? 

GET

Labels (1)
0 Karma

Travis_Stanley
Observer

Specifically listing them  using  the GET is proving troublesome. When I search the returned results, I don't find all alerts, but I do find all reports.

The POST to create and alert is not an issue. 

0 Karma

_JP
Contributor

This is how I have been able to access these things via REST.

The first thing you need to make sure is you have the "Add to Triggered Alerts" Alert Action that you want to be see these in the GUI or REST.  By default, Splunk will run alerts you configure, but won't necessarily "track" them unless you explicitly tell it to.  It looks like this in the GUI:

_JP_0-1697041146758.png

Once you add that Alert Action and some alerts fire, you'll see the triggered events in the GUI and via this REST endpoint:

 

/alerts/fired_alerts/

 

 

Once you're getting your list of triggered alerts, then you can find the sid value within the data returned and then use the other REST endpints to fetch stuff for the actual search that was ran.  Here's a screenshot of a bit of the output from the above rest endpoint on my test environment:

_JP_2-1697041373347.png

Also - note that the Expire setting for the alert will control how long Splunk keeps those results around for those sids:

 

_JP_3-1697041476035.png

 

 

 

0 Karma

Travis_Stanley
Observer

Hi @_JP , Thanks for the reply but that's not what I'm looking for. I want the ability to list and create alerts, not view triggered alerts.

0 Karma
Get Updates on the Splunk Community!

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

 Prepare to elevate your security operations with the powerful upgrade to Splunk Enterprise Security 8.x! This ...

Get Early Access to AI Playbook Authoring: Apply for the Alpha Private Preview ...

Passionate about security automation? Apply now to our AI Playbook Authoring Alpha private preview ...

Reduce and Transform Your Firewall Data with Splunk Data Management

Managing high-volume firewall data has always been a challenge. Noisy events and verbose traffic logs often ...