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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...