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 + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...