Other Usage

Get list of reports and alerts using Splunk SDK

rajeshad
Engager

How can I use Splunk SDK/Rest API to get list of alerts and reports? For example, the page below shows total of 269 alerts. Would like to access these alerts with all its metadata (such as the underlying query).

 

Thanks!

rajeshad_0-1689373959743.png

 

Labels (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Get a list of reports with this REST command

| rest /servicesNS/-/-/saved/searches splunk_server=local 
| search alert_type="always" 

Use this REST command to get a list of alerts

| rest /servicesNS/-/-/saved/searches splunk_server=local 
| search alert_type!="always"
---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Get a list of reports with this REST command

| rest /servicesNS/-/-/saved/searches splunk_server=local 
| search alert_type="always" 

Use this REST command to get a list of alerts

| rest /servicesNS/-/-/saved/searches splunk_server=local 
| search alert_type!="always"
---
If this reply helps you, Karma would be appreciated.
0 Karma

rajeshad
Engager

The query is not listing any events and the data is only available on Statistics tab. Is this expected or am I missing something?

rajeshad_0-1689605165357.png

 

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Yes, that is normal.  The rest command does not search for events - it returns information.

---
If this reply helps you, Karma would be appreciated.
0 Karma

rajeshad
Engager

Thank you, will try it out!

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...