Alerting

How does Splunk work internally when I create an alert and gets loaded to savedsearches.conf?

paramagurukarth
Builder

How do Splunk alerts work?

If we make any changes to the savedsearches.conf manually, it will only get loaded after restarting / refreshing splunk (http://..//debug/refresh), but when we create an alert using the Splunk Web UI, it creates an entry in the same savedsearches.conf and the changes are loaded at the same time.

What does Splunk do internally? Does it trigger the same refresh process or something else?
( If it triggers the refresh process, please let me know how to do that using Splunk's python SDK )

Thanks..

0 Karma
1 Solution

paramagurukarth
Builder

Found a way.. I just want to share.... Please let me know if I am missing anything..
(While we doing http://..//debug/refresh, refres method inside debug.py is executed .. there they call the refreshEntities of splunk.entity.. I just tried the same below...)

try:
     splunk.entity.refreshEntities("admin/savedsearch", namespace='search')
     output.append("Refresh oK ")
except:
     output.append("Failed")
     return '\n'.join(output)

The above loads any manual modification done in savedsearches.conf
It works for me...

View solution in original post

paramagurukarth
Builder

Found a way.. I just want to share.... Please let me know if I am missing anything..
(While we doing http://..//debug/refresh, refres method inside debug.py is executed .. there they call the refreshEntities of splunk.entity.. I just tried the same below...)

try:
     splunk.entity.refreshEntities("admin/savedsearch", namespace='search')
     output.append("Refresh oK ")
except:
     output.append("Failed")
     return '\n'.join(output)

The above loads any manual modification done in savedsearches.conf
It works for me...

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 ...