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!

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