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!

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