<?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 Questions about Splunk SDK for Python and Python 3. in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Questions-about-Splunk-SDK-for-Python-and-Python-3/m-p/449003#M8149</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I am starting with the custom commands in python and have some basic questions I guess.&lt;BR /&gt;The python version is 2.7, which I find a bit awkward as it does not even have the pip or easy_install to get the splunk-sdk installed.&lt;BR /&gt;What we did was to install the python 3 under the /usr/local/bin/python3, then we got the splunk-sdk.&lt;BR /&gt;We relinked the python to python3. The custom commands work fine now ... but the whole rest not really. I get issues with some of my alerts and when restarting, the splunk itself does not come up.&lt;/P&gt;
&lt;P&gt;So, my questions would be:&lt;BR /&gt;- Is it possible to get other version of python (3.5 instead of 2.7) running with Splunk?&lt;BR /&gt;- If not, what would be the easiest way to install the splunk-sdk for python under the 2.7? ... not having the easy_install nor pip unfortunately so the hints from the docu cannot be really followed&lt;BR /&gt;- And, why can't the splunk-sdk be just installed by default when installing Splunk ...&lt;/P&gt;
&lt;P&gt;Kind Regards,&lt;BR /&gt;Kamil&lt;/P&gt;</description>
    <pubDate>Wed, 17 Jun 2020 22:39:26 GMT</pubDate>
    <dc:creator>damucka</dc:creator>
    <dc:date>2020-06-17T22:39:26Z</dc:date>
    <item>
      <title>Questions about Splunk SDK for Python and Python 3.</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Questions-about-Splunk-SDK-for-Python-and-Python-3/m-p/449003#M8149</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I am starting with the custom commands in python and have some basic questions I guess.&lt;BR /&gt;The python version is 2.7, which I find a bit awkward as it does not even have the pip or easy_install to get the splunk-sdk installed.&lt;BR /&gt;What we did was to install the python 3 under the /usr/local/bin/python3, then we got the splunk-sdk.&lt;BR /&gt;We relinked the python to python3. The custom commands work fine now ... but the whole rest not really. I get issues with some of my alerts and when restarting, the splunk itself does not come up.&lt;/P&gt;
&lt;P&gt;So, my questions would be:&lt;BR /&gt;- Is it possible to get other version of python (3.5 instead of 2.7) running with Splunk?&lt;BR /&gt;- If not, what would be the easiest way to install the splunk-sdk for python under the 2.7? ... not having the easy_install nor pip unfortunately so the hints from the docu cannot be really followed&lt;BR /&gt;- And, why can't the splunk-sdk be just installed by default when installing Splunk ...&lt;/P&gt;
&lt;P&gt;Kind Regards,&lt;BR /&gt;Kamil&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2020 22:39:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Questions-about-Splunk-SDK-for-Python-and-Python-3/m-p/449003#M8149</guid>
      <dc:creator>damucka</dc:creator>
      <dc:date>2020-06-17T22:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: splunk sdk for python and python 3</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Questions-about-Splunk-SDK-for-Python-and-Python-3/m-p/449004#M8150</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;It was an issue with our python 2.7 installation, where we were not able to get pip neither easy_install running so we could not implement the splunk-sdk.&lt;BR /&gt;
We workarounded it by pointing in the custom command / python script to the python 3.5 splunk-sdk module. &lt;BR /&gt;
Please see below the example code of the simple sleep60 command.&lt;/P&gt;

&lt;P&gt;Kind Regards,&lt;BR /&gt;
Kamil&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import sys
sys.path.append("/usr/local/lib/python3.5/site-packages/splunk_sdk-1.6.6-py2.7.egg")
import time
from splunklib.searchcommands import dispatch, StreamingCommand, Configuration

@Configuration()
class MyCommand(StreamingCommand):
        def stream(self,records):
                time.sleep(60)
                for record in records:
                        yield record

if __name__ == "__main__":
        dispatch(MyCommand, sys.argv, sys.stdin, sys.stdout, __name__)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Aug 2019 06:43:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Questions-about-Splunk-SDK-for-Python-and-Python-3/m-p/449004#M8150</guid>
      <dc:creator>damucka</dc:creator>
      <dc:date>2019-08-14T06:43:11Z</dc:date>
    </item>
  </channel>
</rss>

