Alerting

unable to run python scripted alert

sbsbb
Builder

I've made a scripted alert in python, and put it in py app directory
.../splunk/etc/apps/myapp/bin/scripts/scripted_alert.py

in .../splunk/var/log/splunk/python.log I see that it has been triggered with the correct path, and parameters :
2014-08-22 14:37:01,178 INFO ['.../splunk/etc/apps/myapp/bin/scripts/scripted_alert.py', '1', '| stats c | eval ...

When I try to execute it with
.../splunk/bin/splunk cmd python .../splunk/etc/apps/myapp/bin/scripts/scripted_alert.py' with all the parameters from the python.log, it is working...

It seems that splunk is not taking the python interpreter ?
But in my file header I have

#!.../splunk/bin/python
# -*- coding: utf-8 -*-

(... is a substitution / I'm using Splunk 5.0.5)

0 Karma

starcher
SplunkTrust
SplunkTrust

Most likely your hash bang is off. I believe in this case the full path should work better. if that is a typical Splunk unix install try:

#!/opt/splunk/bin/python

0 Karma

sbsbb
Builder

this is already the case

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