Splunk Dev

What is the difference between '/opt/splunk/bin/python' and '/opt/splunk/bin/splunk cmd python'

shrirangphadke
Path Finder

Hi,

I am having a strange python behavior in my Splunk environment :

When I run a script with Splunk python as:

/opt/splunk/bin/python my_script.py

it fails. But when I run same script as:

/opt/splunk/bin/splunk cmd python my_script.py

it works. This is really a strange behavior to me.
My questions are:
1. Why first option does not work?
2. What can I do to load 'Splunk cmd python' in my django environment.

0 Karma
1 Solution

MuS
Legend

Hi shrirangphadke,

  1. it does not have the Splunk environment variables set
  2. if you can source /opt/splunk/bin/setSplunkEnv in your django enviroment it will run the script as well

/opt/splunk/bin/splunk is actually a wrapper which load the setSplunkEnv and starts the later command.

Hope this helps ...

cheers, MuS

View solution in original post

MuS
Legend

Hi shrirangphadke,

  1. it does not have the Splunk environment variables set
  2. if you can source /opt/splunk/bin/setSplunkEnv in your django enviroment it will run the script as well

/opt/splunk/bin/splunk is actually a wrapper which load the setSplunkEnv and starts the later command.

Hope this helps ...

cheers, MuS

shrirangphadke
Path Finder

Thanks for your answer @Mus !!

Your answer is a key to some of my major issues.
Thanks again

0 Karma

MuS
Legend

you're welcome 🙂

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...