Getting Data In

Will Splunk run a modular input using system Python on a Universal Forwarder

LukeMurphey
Champion

If I have a modular input written in Python, will Splunk attempt to execute it on a Universal Forwarder if the host has Python installed?

1 Solution

LukeMurphey
Champion

Yes, it will.

Splunk will invoke the system's Python interpreter and run the modular input. Splunk's libraries will not be available (e.g. you won't be able to import splunk in Python) but the the forwarder will attempt to run the input just as it would on a Splunk install that was bundled with Python.

View solution in original post

LukeMurphey
Champion

Yes, it will.

Splunk will invoke the system's Python interpreter and run the modular input. Splunk's libraries will not be available (e.g. you won't be able to import splunk in Python) but the the forwarder will attempt to run the input just as it would on a Splunk install that was bundled with Python.

joshuapetitt
Path Finder

precisely "how" will splunk invoke the system's Python interpreter? I have python 3 and python 2 installed on the system, and the python calls python 3 because how how the PATH is setup. Can I somehow override to tell splunk which python to use?

0 Karma

LukeMurphey
Champion

@joshuapetit: I don't exactly know but I will suspect that Splunk is calling the first interpreter per the PATH setup. You might want to try setting the PATH such that other interpreter is first and seeing if Splunk uses that one instead.

0 Karma

joshuapetitt
Path Finder

Thanks for the reply, I'm trying to do that very thing. Although other parts of the system rely on python 3 being first in the PATH. Is there a way I can set the PATH variable for just the Universal Forwarder? Perhaps via a .conf file?

0 Karma

LukeMurphey
Champion

You should be able to set the PATH via splunk-launch.conf.

Alternatively, it could likely be tested just by doing a local install of Splunk to see if Splunk does indeed use the PATH. In that case, you could likely just sudo to root, adjust the path and then start Splunk manually to see which Python it uses.

0 Karma

joshuapetitt
Path Finder

I've edited the system PATH and Splunk does just call the first python that is found in the path. I'm trying now to set the path in splunk-launch.conf but am not having any success at this. I've started a new question about that here:

https://answers.splunk.com/answers/672234/splunk-universal-forwarder-how-to-set-path-environ.html

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