Alerting

Get auth token in alert script

Leo
Splunk Employee
Splunk Employee

Is it possible to get an auth token/session key in a python script triggered by an alert?

Tags (3)
0 Karma
1 Solution

starcher
SplunkTrust
SplunkTrust

It work the same as it does for scheduled or modular inputs. I have actual walk through and link to already made code in my git repo. http://www.georgestarcher.com/2014/02/16/splunk-alert-scripts-automating-control/

View solution in original post

starcher
SplunkTrust
SplunkTrust

It work the same as it does for scheduled or modular inputs. I have actual walk through and link to already made code in my git repo. http://www.georgestarcher.com/2014/02/16/splunk-alert-scripts-automating-control/

Leo
Splunk Employee
Splunk Employee

yeah, it does indeed. I messed up by calling Intersplunk.getOrganizedResults() before reading from the stdin. And now I see that Intersplunk actually reads from stdin itself.

0 Karma

starcher
SplunkTrust
SplunkTrust

There was nothing special required for it to work and it does pass on stdio by design of Splunk. I have it working without issue on both Splunk v5 and Splunk v6. Is the hash bang at the the top of your alert script set to the correct path for your installation?

0 Karma

Leo
Splunk Employee
Splunk Employee

thanks, but looking at your alert_to_gsheet.py file, it seems like the session key is expected to be sent via stdin, which doesn't happen in my case. Do you have any special config that enables passing it? I tried setting 'passauth=true' in commands.conf, trying to trick it as if it was a search command and it still doesn't work: reading sys.stdin.readline() comes back empty...

Get Updates on the Splunk Community!

Maximize the Value from Microsoft Defender with Splunk

 Watch NowJoin Splunk and Sens Consulting for this Security Edition Tech TalkWho should attend:  Security ...

This Week's Community Digest - Splunk Community Happenings [6.27.22]

Get the latest news and updates from the Splunk Community here! News From Splunk Answers ✍️ Splunk Answers is ...

Reminder! Splunk Love Promo: $25 Visa Gift Card for Your Honest SOAR Review With ...

We recently launched our first Splunk Love Special, and it's gone phenomenally well, so we're doing it again, ...