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

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

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

you're welcome 🙂

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...