|
How can I add a python module that is not included in the Splunk python bundle? Specifically, I would like to use the pymssql module from within Splunk to run a scripted input. |
|
Users are free to install any python module they desire. The caveats are, 1) upgrading Splunk may break them, 2) installing newer versions of packages that come with Splunk may produce unknown interaction problems. To install a python package in splunk:
So if the package uses the setup.py method:
Or if it's an egg,
The final location of the installed modules would be:
Is that still supported with 4.1 ? I tried both ways, first one prouced errors, second one didn't produce any output and nothing was installed.
(28 Jan '11, 16:21)
wollinet
|
|
There's also a more upgrade-friendly way to accomplish this. Some of our users setup whichever script they've configured in Splunk as a pass-through to a script that runs using their system Python (with whichever custom modules they've installed). The steps are roughly:
script2 can then load any arbitrary python module installed in your system's python installation. Is there a step by step tutorial to accomplish this on a Linux environment?
(04 Oct '11, 00:27)
Dark_Ichigo
|
|
Updating your Splunk Python is not supported (by Splunk). The recommended method is to update your system's Python or install a 3rd copy of Python that is not located in your PATH. |
|
Here is an example, tested on Linux and Windows, that uses a non-splunk python but still lets you load most Splunk modules: wrapper.py:
my_script.py:
|
|
i have 3 pythons in my linux server, local 2.3, 2.5 and 2.6(in splunk4.0.8). I can not install MySQL-python-1.2.3c1 to 2.6, but it's ok to install it to local 2.3. the following is the detail. cd MySQL-python-1.2.3c1 python2.6 setup.py build ImportError: No module named setuptools sh setuptools-0.6c11-py2.6.egg ImportError: No module named command.bdist [root@localhost bin]# ./splunk cmd /local/dl/setuptools-0.6c11-py2.6.egg Traceback (most recent call last): File "", line 1, in File "/local/dl/setuptools-0.6c11-py2.6.egg/setuptools/init.py", line 2, in File "/local/dl/setuptools-0.6c11-py2.6.egg/setuptools/extension.py", line 2, in File "/local/dl/setuptools-0.6c11-py2.6.egg/setuptools/dist.py", line 5, in File "/local/dl/setuptools-0.6c11-py2.6.egg/setuptools/command/init.py", line 13, in ImportError: No module named command.bdist [root@localhost bin]# ./splunk cmd /local/dl/MySQL_python-1.2.3c1-py2.6-linux-i686.egg couldn't run "/local/dl/MySQL_python-1.2.3c1-py2.6-linux-i686.egg": Exec format error @the_wolverine, how to tell splunk to execute lookup python script with system's Python? Thanks, Dianbo No, there's no way to tell splunk to run some other python. However, you can make the script itself do this as per amrit's comment.
(15 Dec '10, 18:44)
jrodman ♦
|
