Splunk Enterprise

Pass alert count as argument to python script

subramanianp789
New Member

Hi,


I have a requirement to get the alert count from "Searches, Reports, and Alerts" under the Alerts column for the specific saved search.

This Alert count needs to pass as an argument to a python script which will have a counter variable to check the alert value and if crosses certain conditions then send mail has to trigger. How to achieve this.

Thanks

Labels (1)
0 Karma

harsmarvania57
Ultra Champion
0 Karma

subramanianp789
New Member

Thanks for your reply.
But how to get the alert count value from "Searches, Reports, and Alerts" under Alerts column for the specific saved search.

Any config file the alert counts will be saved.

0 Karma

harsmarvania57
Ultra Champion

I don't have your usecase so not sure whether this will help or not, when you run schedule search you can add custom search command in your query or you can add custom alert action in that schedule search.

if you create custom search command then you can use schedule search query output in python script and do math in your script to count number of alerts and then pass that count to another function which have counter variable to check the alert value and send email from that python script.
If you create custom alert actions then you can use results.csv.gz in your python script, results.csv.gz contain search query output so based on that data you can do math in your python script to count number of alerts and then pass that count to another function which have counter variable to check the alert value and send email from that python script.

0 Karma
Get Updates on the Splunk Community!

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...

Cloud Platform & Enterprise: Classic Dashboard Export Feature Deprecation

As of Splunk Cloud Platform 9.3.2408 and Splunk Enterprise 9.4, classic dashboard export features are now ...

Explore the Latest Educational Offerings from Splunk (November Releases)

At Splunk Education, we are committed to providing a robust learning experience for all users, regardless of ...