<?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: How to use python library in Splunk? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-to-use-python-library-in-Splunk/m-p/279694#M3508</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:49 GMT</pubDate>
    <dc:creator>joelurtubia</dc:creator>
    <dc:date>2020-09-29T16:36:49Z</dc:date>
    <item>
      <title>How to use python library in Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-use-python-library-in-Splunk/m-p/279688#M3502</link>
      <description>&lt;P&gt;I know there is documentation, however, can someone give a simple example (with steps) for installing/using a python module from the native python library in Splunk?  If it is not native please example how to install it into SPL v 6.2.3&lt;/P&gt;

&lt;P&gt;Any explanation how to get started with python in Splunk is appreciated.&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2016 16:39:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-use-python-library-in-Splunk/m-p/279688#M3502</guid>
      <dc:creator>packet_hunter</dc:creator>
      <dc:date>2016-02-11T16:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to use python library in Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-use-python-library-in-Splunk/m-p/279689#M3503</link>
      <description>&lt;P&gt;Python is built-in to Splunk so no installation is required.  What do you want to do with Python?  Are you creating a scripted input or something else?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2016 17:14:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-use-python-library-in-Splunk/m-p/279689#M3503</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-02-11T17:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to use python library in Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-use-python-library-in-Splunk/m-p/279690#M3504</link>
      <description>&lt;P&gt;Scenario:  I need to look at all incoming email domains (e.g. sender@&lt;STRONG&gt;domain&lt;/STRONG&gt;.tld) and compare them to a white list of domains to see if the new arrivals are typo-squatting, fuzzing, etc. (e.g. sender@&lt;STRONG&gt;domaininc&lt;/STRONG&gt;.tld).  I am not looking for exact matches but permutations of the white list.&lt;/P&gt;

&lt;P&gt;I have tried "cluster" but it slows the search to a crawl.   Therefore I was thinking of using some python scripts to do some of the heavy lifting (comparing).  Maybe I am off track...&lt;/P&gt;

&lt;P&gt;If you have any suggestions please let me know.&lt;/P&gt;

&lt;P&gt;Of course, I am also interested in using python for other SPL enhancements as well.&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2016 18:28:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-use-python-library-in-Splunk/m-p/279690#M3504</guid>
      <dc:creator>packet_hunter</dc:creator>
      <dc:date>2016-02-11T18:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to use python library in Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-use-python-library-in-Splunk/m-p/279691#M3505</link>
      <description>&lt;P&gt;Generally speaking, you write a Python script that performs the needed functions and place it in your app's 'bin' directory.  The script is then invoked either by a custom search command.  See &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.3/Search/Aboutcustomsearchcommands"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.3/Search/Aboutcustomsearchcommands&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2016 18:43:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-use-python-library-in-Splunk/m-p/279691#M3505</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-02-11T18:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to use python library in Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-use-python-library-in-Splunk/m-p/279692#M3506</link>
      <description>&lt;P&gt;That makes sense.  Thank you &lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2016 18:54:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-use-python-library-in-Splunk/m-p/279692#M3506</guid>
      <dc:creator>packet_hunter</dc:creator>
      <dc:date>2016-02-11T18:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to use python library in Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-use-python-library-in-Splunk/m-p/279693#M3507</link>
      <description>&lt;P&gt;Hi Rich, I don't have an option to accept your answer.   If your comment an answer then I will accept it. Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2016 21:14:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-use-python-library-in-Splunk/m-p/279693#M3507</guid>
      <dc:creator>packet_hunter</dc:creator>
      <dc:date>2016-02-18T21:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to use python library in Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-use-python-library-in-Splunk/m-p/279694#M3508</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:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-use-python-library-in-Splunk/m-p/279694#M3508</guid>
      <dc:creator>joelurtubia</dc:creator>
      <dc:date>2020-09-29T16:36:49Z</dc:date>
    </item>
  </channel>
</rss>

