Getting Data In

Can I use a python script on a Windows universal forwarder?

ryuch2002
Explorer

os: windows 7-64bit / splunk 6.2.0 / universal forwarder 6.2.0

current my python inputs.conf

[script://.\bin\test\test.py]

i know that universal forwarder doesn't include python bundle, but i want python script on the universal forwarder.

i tried python install and set [script://python_path\python .\bin\test\test.py], but it failed.

Is there any way?

0 Karma
1 Solution

lguinn2
Legend

Yes! You can run Python scripts on the UF. But, you need to launch your script from within a shell script (or BAT script on Windows).

So your inputs.conf would be

[script://.\bin\test\launchtest.sh]

And launchtest.sh would contain something like this

#!/bin/sh
# launch the python script 
# you could include environment variables, more specific path names, etc as needed
./test.py

Make sure that launchtest.sh is executable. Thats's all you need!

View solution in original post

lguinn2
Legend

Yes! You can run Python scripts on the UF. But, you need to launch your script from within a shell script (or BAT script on Windows).

So your inputs.conf would be

[script://.\bin\test\launchtest.sh]

And launchtest.sh would contain something like this

#!/bin/sh
# launch the python script 
# you could include environment variables, more specific path names, etc as needed
./test.py

Make sure that launchtest.sh is executable. Thats's all you need!

ryuch2002
Explorer

Thank you for answers.
Fixed an issue thanks to you.

0 Karma

ajitshukla
Explorer

could you please provide me steps to run the python script on universal forwarder ,since I am new to splunk I don't know how to run .bat file in windows .please provide all configuration details like input.conf and other configuration file.

I would be great help for me

0 Karma

meenuvn
Explorer

Do we need to install Python to run the script? Or UF comes with Python interpreter?

0 Karma

ryuch2002
Explorer

I installed Python in windows, and set PYTHON_HOME. try it.

0 Karma
Get Updates on the Splunk Community!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...