<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Can I add python modules to the Splunk environment? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9077#M19</link>
    <description>&lt;P&gt;&lt;STRONG&gt;virtualenv&lt;/STRONG&gt; can be used to create a standalone Python installation with whatever modules are required. The scripted input could then use a wrapper script to activate the virtualenv, execute the Python script, and deactivate the virtualenv. This works okay if the native &lt;STRONG&gt;splunk&lt;/STRONG&gt; module isn't required.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;script.py&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#!/usr/bin/env python
import package
package.do_stuff()
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;script_wrapper.sh&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#!/bin/bash
source /path/to/virtual/env/bin/activate
python /path/to/script.py
deactivate
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 17 May 2016 15:28:39 GMT</pubDate>
    <dc:creator>rlacher1</dc:creator>
    <dc:date>2016-05-17T15:28:39Z</dc:date>
    <item>
      <title>Can I add python modules to the Splunk environment?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9064#M6</link>
      <description>&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2020 18:14:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9064#M6</guid>
      <dc:creator>Simeon</dc:creator>
      <dc:date>2020-06-18T18:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add python modules to the Splunk environment?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9065#M7</link>
      <description>&lt;P&gt;Just use the standard way of installing modules (make sure that splunk and python are in path):&lt;BR /&gt;
Untar pymssql-1.0.2.tar.gz&lt;BR /&gt;
cd pymssql-1.0.2&lt;BR /&gt;
splunk cmd python setup.py install&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Nov 2009 04:37:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9065#M7</guid>
      <dc:creator>igor</dc:creator>
      <dc:date>2009-11-07T04:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add python modules to the Splunk environment?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9066#M8</link>
      <description>&lt;P&gt;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.&lt;/P&gt;

&lt;P&gt;To install a python package in splunk:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$ splunk cmd &amp;lt;python_install_command&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So if the package uses the setup.py method:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$ cd path_to_package_setup
$ splunk cmd python setup.py install
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or if it's an egg,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$ splunk cmd ./my-python-installer.egg
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The final location of the installed modules would be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$SPLUNK_HOME/lib/python2.6/site-packages
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 07 Nov 2009 06:23:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9066#M8</guid>
      <dc:creator>Johnvey</dc:creator>
      <dc:date>2009-11-07T06:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add python modules to the Splunk environment?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9067#M9</link>
      <description>&lt;P&gt;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).&lt;/P&gt;

&lt;P&gt;The steps are roughly:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;configure your script in splunk (search script, scripted input, whatever)&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;this script should:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;unset PYTHONPATH (in os.environ)&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;perhaps unset LD_LIBRARY_PATH, depending on your environment (also in os.environ)&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;create a process to run /usr/bin/python  (via subprocess)&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;redirect stdin, stdout, stderr to/from script2&lt;/P&gt;&lt;/LI&gt;
&lt;/UL&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;script2 can then load any arbitrary python module installed in your system's python installation.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2009 03:06:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9067#M9</guid>
      <dc:creator>amrit</dc:creator>
      <dc:date>2009-11-13T03:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add python modules to the Splunk environment?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9068#M10</link>
      <description>&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2010 06:34:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9068#M10</guid>
      <dc:creator>the_wolverine</dc:creator>
      <dc:date>2010-02-13T06:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add python modules to the Splunk environment?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9069#M11</link>
      <description>&lt;P&gt;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.&lt;/P&gt;

&lt;P&gt;cd MySQL-python-1.2.3c1&lt;/P&gt;

&lt;P&gt;python2.6 setup.py build
&lt;STRONG&gt;ImportError: No module named setuptools&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;sh setuptools-0.6c11-py2.6.egg
&lt;STRONG&gt;ImportError: No module named command.bdist&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;[root@localhost bin]# ./splunk cmd /local/dl/setuptools-0.6c11-py2.6.egg&lt;/STRONG&gt;
Traceback (most recent call last):
  File "", line 1, in 
  File "/local/dl/setuptools-0.6c11-py2.6.egg/setuptools/&lt;STRONG&gt;init&lt;/STRONG&gt;.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/&lt;STRONG&gt;init&lt;/STRONG&gt;.py", line 13, in 
&lt;STRONG&gt;ImportError: No module named command.bdist&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;[root@localhost bin]# ./splunk cmd /local/dl/MySQL_python-1.2.3c1-py2.6-linux-i686.egg&lt;/STRONG&gt;
couldn't run "/local/dl/MySQL_python-1.2.3c1-py2.6-linux-i686.egg": Exec format error&lt;/P&gt;

&lt;P&gt;@the_wolverine, how to tell splunk to execute lookup python script with system's Python?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Dianbo&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2010 11:00:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9069#M11</guid>
      <dc:creator>dianbo</dc:creator>
      <dc:date>2010-03-11T11:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add python modules to the Splunk environment?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9070#M12</link>
      <description>&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2010 02:44:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9070#M12</guid>
      <dc:creator>jrodman</dc:creator>
      <dc:date>2010-12-16T02:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add python modules to the Splunk environment?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9071#M13</link>
      <description>&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jan 2011 00:21:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9071#M13</guid>
      <dc:creator>wollinet</dc:creator>
      <dc:date>2011-01-29T00:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add python modules to the Splunk environment?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9072#M14</link>
      <description>&lt;P&gt;Here is an example, tested on Linux and Windows, that uses a non-splunk python but still lets you load &lt;STRONG&gt;most&lt;/STRONG&gt; Splunk modules:&lt;/P&gt;

&lt;P&gt;wrapper.py:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import os
import subprocess

_NEW_PYTHON_PATH = '/usr/bin/python'
_SPLUNK_PYTHON_PATH = os.environ['PYTHONPATH']

os.environ['PYTHONPATH'] = _NEW_PYTHON_PATH 
my_process = os.path.join(os.getcwd(), 'my_script.py')

p = subprocess.Popen([os.environ['PYTHONPATH'], my_process, _SPLUNK_PYTHON_PATH], 
                      stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output = p.communicate()[0]
print output
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;my_script.py:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import sys 
import os

#This step is necessary in order to load splunk packages
from optparse import OptionParser
parser = OptionParser()
(options, args) = parser.parse_args()
_SPLUNK_PYTHON_PATH = args[0]
sys.path.append(_SPLUNK_PYTHON_PATH)

import splunk
import cherrypy
import some_package_from_new_python
...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Feb 2011 06:17:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9072#M14</guid>
      <dc:creator>araitz</dc:creator>
      <dc:date>2011-02-03T06:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add python modules to the Splunk environment?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9073#M15</link>
      <description>&lt;P&gt;Is there a step by step tutorial to accomplish this on a Linux environment?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2011 07:27:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9073#M15</guid>
      <dc:creator>Dark_Ichigo</dc:creator>
      <dc:date>2011-10-04T07:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add python modules to the Splunk environment?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9074#M16</link>
      <description>&lt;P&gt;I just want to add how i installed &lt;CODE&gt;ipython&lt;/CODE&gt; on splunk's python install. I downloaded the tar.gz and did:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$ splunk cmd python setup.py install
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I got an error:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ImportError: No module named command.build_py
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It turns out &lt;CODE&gt;distutils&lt;/CODE&gt; in splunk's python install does not have the command module. The way I got around this is to use &lt;CODE&gt;distutils&lt;/CODE&gt; from another python 2.7 install by adding its directory to &lt;CODE&gt;PYTHONPATH&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$ export PYTHONPATH=$HOME/python272/lib/python2.7
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and installed using setup.py again&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$ splunk cmd python setup.py install
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;finally:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$ splunk cmd ipython
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Mar 2012 15:56:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9074#M16</guid>
      <dc:creator>hans</dc:creator>
      <dc:date>2012-03-19T15:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add python modules to the Splunk environment?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9075#M17</link>
      <description>&lt;P&gt;Guys,&lt;/P&gt;

&lt;P&gt;Its simple,&lt;BR /&gt;
Copy your required packages/files from &lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;&lt;STRONG&gt;/usr/local/lib/python2.7/dist-packages&lt;/STRONG&gt; &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;&lt;STRONG&gt;/opt/splunk/lib/python2.7/site-packages/&lt;/STRONG&gt;&lt;/P&gt;

&lt;HR /&gt;</description>
      <pubDate>Fri, 27 Sep 2013 14:13:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9075#M17</guid>
      <dc:creator>asifhj</dc:creator>
      <dc:date>2013-09-27T14:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add python modules to the Splunk environment?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9076#M18</link>
      <description>&lt;P&gt;As another option I would checkout this post on how to add egg file or source files while still using Splunk python rather than system. &lt;A href="http://answers.splunk.com/answers/220196/import-non-native-python-libraries-into-splunk.html#answer-222585"&gt;http://answers.splunk.com/answers/220196/import-non-native-python-libraries-into-splunk.html#answer-222585&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 17:25:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9076#M18</guid>
      <dc:creator>bmacias84</dc:creator>
      <dc:date>2015-07-07T17:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add python modules to the Splunk environment?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9077#M19</link>
      <description>&lt;P&gt;&lt;STRONG&gt;virtualenv&lt;/STRONG&gt; can be used to create a standalone Python installation with whatever modules are required. The scripted input could then use a wrapper script to activate the virtualenv, execute the Python script, and deactivate the virtualenv. This works okay if the native &lt;STRONG&gt;splunk&lt;/STRONG&gt; module isn't required.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;script.py&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#!/usr/bin/env python
import package
package.do_stuff()
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;script_wrapper.sh&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#!/bin/bash
source /path/to/virtual/env/bin/activate
python /path/to/script.py
deactivate
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 May 2016 15:28:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9077#M19</guid>
      <dc:creator>rlacher1</dc:creator>
      <dc:date>2016-05-17T15:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add python modules to the Splunk environment?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9078#M20</link>
      <description>&lt;P&gt;how to make this on django web framework &lt;BR /&gt;
i make an splunk app and i need to import some non native python module &lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 15:29:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9078#M20</guid>
      <dc:creator>heshamzaid</dc:creator>
      <dc:date>2017-01-03T15:29:35Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add python modules to the Splunk environment?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9079#M21</link>
      <description>&lt;P&gt;Hello, I was the same problem with Mysql module that I was install on my Centos server&lt;/P&gt;

&lt;P&gt;Splunk didn't work with this library, because splunk has they own python library...then you can fix it only added on the begin your script all libraries of python and also you must to add the python Centos library too... as this way&lt;/P&gt;

&lt;H3&gt;Find python packages&lt;/H3&gt;

&lt;P&gt;[root@xxxx]#find / -name site-packages&lt;BR /&gt;
/usr/lib/python2.7/site-packages&lt;BR /&gt;
/usr/lib64/python2.7/site-packages&lt;BR /&gt;
/opt/splunk/etc/apps/Splunk_SA_Scientific_Python_linux_x86_64/bin/linux_x86_64/lib/python2.7/site-packages&lt;BR /&gt;
/opt/splunk/lib/python2.7/site-packages&lt;/P&gt;

&lt;H3&gt;Find python binary&lt;/H3&gt;

&lt;P&gt;[root@xxxx]# whereis python&lt;BR /&gt;
python: /usr/bin/python2.7 /usr/bin/python /usr/lib/python2.7 /usr/lib64/python2.7 /etc/python /usr/include/python2.7 /opt/splunk/bin/python /opt/splunk/bin/python2.7 /usr/share/man/man1/python.1.gz&lt;/P&gt;

&lt;P&gt;include all at begin your script&lt;/P&gt;

&lt;P&gt;import sys&lt;BR /&gt;
sys.path.append('/usr/bin/python2.7')&lt;BR /&gt;
sys.path.append('/usr/lib/python2.7/site-packages')&lt;BR /&gt;
sys.path.append('/usr/lib64/python2.7/site-packages')&lt;/P&gt;

&lt;P&gt;And that's it , you can run mysql module without any problem and create your alerts with this module.&lt;/P&gt;

&lt;H3&gt;Mysql Connection&lt;/H3&gt;

&lt;P&gt;import mysql.connector&lt;/P&gt;

&lt;P&gt;I hope that this fix will help you&lt;BR /&gt;
Joel Urtubia Ugarte&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:36:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9079#M21</guid>
      <dc:creator>joelurtubia</dc:creator>
      <dc:date>2020-09-29T16:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add python modules to the Splunk environment?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9080#M22</link>
      <description>&lt;P&gt;Best supported way to do this and still have Splunk support on your side.&lt;BR /&gt;
Do not overwrite Splunk native libraries as you could break the product.&lt;BR /&gt;
or even upgrades to the product or your server could break you.&lt;BR /&gt;
What you do is import the library on the fly during execution of your script.&lt;/P&gt;

&lt;P&gt;Your initial script would do these three lines at the top&lt;BR /&gt;
import sys&lt;BR /&gt;
sys.path.insert(0,'/Path of Library you want to add')&lt;BR /&gt;
import YOURLIBRARY&lt;/P&gt;

&lt;P&gt;Even better for clustered environments with many search heads out there.&lt;BR /&gt;
Create an App on your cluster master responsible for deploying to the search heads and leave it hidden so it wont show on the searcheads.&lt;BR /&gt;
call your app lets say&lt;BR /&gt;
"prod_searchhead_bin"&lt;BR /&gt;
in there you have the magic folder BIN where you put all you secret libraries.&lt;/P&gt;

&lt;P&gt;then you command would look like this &lt;BR /&gt;
import sys&lt;BR /&gt;
sys.path.insert(0,'/opt/splunk/etc/apps/prod_searchhead_bin/bin')&lt;BR /&gt;
import YOURLIBRARY&lt;/P&gt;

&lt;P&gt;then when you publish to the cluster all search heads will comply and have libraries making it a breeze during upgrades/ updates.&lt;BR /&gt;
if you upgrade or move environments. easy to deploy as it is a native app to deploy and make all your much needed libraries available.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:44:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9080#M22</guid>
      <dc:creator>BrunoLabelle</dc:creator>
      <dc:date>2020-09-29T19:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add python modules to the Splunk environment?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9081#M23</link>
      <description>&lt;P&gt;Hy,&lt;BR /&gt;
a working workharound.&lt;/P&gt;

&lt;P&gt;on your wrapper.sh, call your python script by using full path :&lt;/P&gt;

&lt;P&gt;/usr/bin/python $SPLUNK_HOME/bin/scripts/yourpythonscript.py&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 13:20:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9081#M23</guid>
      <dc:creator>ebuitweb</dc:creator>
      <dc:date>2018-11-08T13:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add python modules to the Splunk environment?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9082#M24</link>
      <description>&lt;P&gt;Hey ebuitweb. if you put your library inside the splunk home... the minute you do an upgrade to Splunk... your libraries would get nuked... also if you have a cluster this would require you to login to every search head and edit the internal splunk home scripts directory... as well you may break the native product looking into that directory.... i would advise if you dont want headaches with support... dont put stuff in there... instead put it inside an app and deploy to the search heads.  if you need more granular details about it, let me know and i can post a more granular detailed way to set it up and keep support on your side.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 18:49:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9082#M24</guid>
      <dc:creator>BrunoLabelle</dc:creator>
      <dc:date>2018-11-08T18:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: Can I add python modules to the Splunk environment?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9083#M25</link>
      <description>&lt;P&gt;although this would work technically... this would be a bad idea&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Reasons:&lt;/STRONG&gt;&lt;BR /&gt;
if you add libraries in the native folder...&lt;BR /&gt;
clustered environments would require you to login to every search heads to do this update.&lt;BR /&gt;
you may by mistake break the native folder of splunk where it gets its own libraries.... Support wont be happy with you if they notice unwanted libraries in there.&lt;BR /&gt;
when you upgrade Splunk software that directory gets nuked for the new release... meaning if you forget you may loose all your libraries.&lt;/P&gt;

&lt;P&gt;To stay a happy admin and deploy quick and keep support on your side. you want to publish a hidden app with the libraries and reference them from there during execution of your code ... if your not familiar with this setup and want more details let me know and i can post a more detailed step to setting it up.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 18:54:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-I-add-python-modules-to-the-Splunk-environment/m-p/9083#M25</guid>
      <dc:creator>BrunoLabelle</dc:creator>
      <dc:date>2018-11-08T18:54:05Z</dc:date>
    </item>
  </channel>
</rss>

