Splunk Search

Python script - generating command plus sending email

BernardEAI
Communicator

Good day

I'm trying to write a python script that will be called from Splunk search. The script has a generating command:

@Configuration(type='reporting')
class getInfo(GeneratingCommand):
    def generate(self):
      ....
      ....

After the generating command I want to send an email. I have managed to get the generating command working, as well as the email sending working, but not both in the same script. For the generating command, the commands.conf file details are:

[kvstoreupdate]
filename = kvstore_update.py
chunked = true
generating = true

For the sendemail script the commands.conf is:

[testemail]
filename = email_test.py
streaming = false
run_in_preview = false
passauth = true
required_fields =
changes_colorder = false
supports_rawargs = true
undo_scheduler_escaping = true
is_risky = true
supports_multivalues = true

I have found that the testemail script does not work if I set "chunked=true" i.e. make use of SCPv2. Conversely, the generating command does not work if "chunked=true" is not set - I get the error: 

Script output = "chunked 1.0,426,0.... .... .... Failed to parse transport header: authString:<auth> .... ...."

I'm wondering if it is possible to do both of these actions, since they seem to be compatible with different versions of SCP...?

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...