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!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...