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!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

 (view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...