Getting Data In

Delete fired-alerts via endpoint?

rroberts
Splunk Employee
Splunk Employee

I can list fired-alerts via endpoint https://localhost:8089/servicesNS/admin/search/alerts/fired_alerts/-
There is a way to delete fired-alerts via API?

Tags (2)
1 Solution

rroberts
Splunk Employee
Splunk Employee

Found snippet example using Python internal SDK:

Fired_alert.py

Provides object mapping for fired alerts objects

Example use case:

sessionKey = splunk.auth.getSessionKey('admin','changeme')

s = SavedSearch.get('/servicesNS/admin/search/admin/savedsearch/someAlert')
alerts = s.get_alerts()

# print them all
for a in alerts:

print a.severity, str(a.trigger_time), str(action)

#now delete the most recent one

alerts[0].delete()

View solution in original post

mzorzi
Splunk Employee
Splunk Employee

rroberts
Splunk Employee
Splunk Employee

Found snippet example using Python internal SDK:

Fired_alert.py

Provides object mapping for fired alerts objects

Example use case:

sessionKey = splunk.auth.getSessionKey('admin','changeme')

s = SavedSearch.get('/servicesNS/admin/search/admin/savedsearch/someAlert')
alerts = s.get_alerts()

# print them all
for a in alerts:

print a.severity, str(a.trigger_time), str(action)

#now delete the most recent one

alerts[0].delete()

sbsbb
Builder

Hi Robert, could you post your entire code here ?

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...