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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...