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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...