<?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 resolve Splunk SDK for Python custom streaming search command? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274746#M3438</link>
    <description>&lt;P&gt;Update, I stuck this in logging.conf:&lt;/P&gt;

&lt;P&gt;[handlers]&lt;BR /&gt;
keys =&lt;/P&gt;

&lt;P&gt;Now, there is a fun new error:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;02-02-2017 14:38:25.649 ERROR ChunkedExternProcessor - stderr:   File "/opt/splunk/etc/apps/ip_asn/bin/splunklib/searchcommands/environment.py", line 102, in configure_logging
02-02-2017 14:38:25.649 ERROR ChunkedExternProcessor - stderr:     fileConfig(filename, {'SPLUNK_HOME': splunk_home})
02-02-2017 14:38:25.649 ERROR ChunkedExternProcessor - stderr:   File "/opt/splunk/lib/python2.7/logging/config.py", line 86, in fileConfig
02-02-2017 14:38:25.649 ERROR ChunkedExternProcessor - stderr:     _install_loggers(cp, handlers, disable_existing_loggers)
02-02-2017 14:38:25.649 ERROR ChunkedExternProcessor - stderr:   File "/opt/splunk/lib/python2.7/logging/config.py", line 205, in _install_loggers
02-02-2017 14:38:25.649 ERROR ChunkedExternProcessor - stderr:     log.addHandler(handlers[hand])
02-02-2017 14:38:25.649 ERROR ChunkedExternProcessor - stderr: KeyError: 'stderr'
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 02 Feb 2017 19:39:50 GMT</pubDate>
    <dc:creator>kcnolan13</dc:creator>
    <dc:date>2017-02-02T19:39:50Z</dc:date>
    <item>
      <title>How to resolve Splunk SDK for Python custom streaming search command?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274745#M3437</link>
      <description>&lt;P&gt;I am building a custom streaming search command using the Python SDK and the instructions laid out &lt;A href="http://dev.splunk.com/view/python-sdk/SP-CAAAEU2"&gt;here&lt;/A&gt;. So far, I'm just testing the basic process of trying to get the command to run from within Splunk (i.e. the command itself doesn't do anything yet). However, I'm running into trouble simply importing the SDK libraries shown in the example. Here is a stack trace from the job inspector:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2422i3987486B3784DC08/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I copied the splunklib folder from the SDK into my app's bin directory, and below is the streaming command's code so far. Anyone have an idea what's wrong here? I'm not sure what "No section: 'handlers'" would mean in this context.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import sys
from splunklib.searchcommands import dispatch, StreamingCommand, Configuration, Option, validators


@Configuration()
class ipasnCommand(StreamingCommand):

    def stream(self, events):
        # Put your event transformation code here
        pass

dispatch(ipasnCommand, sys.argv, sys.stdin, sys.stdout, __name__)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Feb 2017 19:11:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274745#M3437</guid>
      <dc:creator>kcnolan13</dc:creator>
      <dc:date>2017-02-02T19:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Splunk SDK for Python custom streaming search command?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274746#M3438</link>
      <description>&lt;P&gt;Update, I stuck this in logging.conf:&lt;/P&gt;

&lt;P&gt;[handlers]&lt;BR /&gt;
keys =&lt;/P&gt;

&lt;P&gt;Now, there is a fun new error:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;02-02-2017 14:38:25.649 ERROR ChunkedExternProcessor - stderr:   File "/opt/splunk/etc/apps/ip_asn/bin/splunklib/searchcommands/environment.py", line 102, in configure_logging
02-02-2017 14:38:25.649 ERROR ChunkedExternProcessor - stderr:     fileConfig(filename, {'SPLUNK_HOME': splunk_home})
02-02-2017 14:38:25.649 ERROR ChunkedExternProcessor - stderr:   File "/opt/splunk/lib/python2.7/logging/config.py", line 86, in fileConfig
02-02-2017 14:38:25.649 ERROR ChunkedExternProcessor - stderr:     _install_loggers(cp, handlers, disable_existing_loggers)
02-02-2017 14:38:25.649 ERROR ChunkedExternProcessor - stderr:   File "/opt/splunk/lib/python2.7/logging/config.py", line 205, in _install_loggers
02-02-2017 14:38:25.649 ERROR ChunkedExternProcessor - stderr:     log.addHandler(handlers[hand])
02-02-2017 14:38:25.649 ERROR ChunkedExternProcessor - stderr: KeyError: 'stderr'
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Feb 2017 19:39:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274746#M3438</guid>
      <dc:creator>kcnolan13</dc:creator>
      <dc:date>2017-02-02T19:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Splunk SDK for Python custom streaming search command?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274747#M3439</link>
      <description>&lt;P&gt;Okay, so just by playing around with it, I seem to have worked around the errors. &lt;/P&gt;

&lt;P&gt;Using this did the trick:&lt;BR /&gt;
    [handlers]&lt;BR /&gt;
    keys = app, splunklib, stderr&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 19:54:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274747#M3439</guid>
      <dc:creator>kcnolan13</dc:creator>
      <dc:date>2017-02-02T19:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Splunk SDK for Python custom streaming search command?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274748#M3440</link>
      <description>&lt;P&gt;You're importing Configuration which I assume is causing this.&lt;/P&gt;

&lt;P&gt;Try breaking your imports out into one line each and see what line causes the error.  99% chance it's Configuration.&lt;/P&gt;

&lt;P&gt;from splunklib.searchcommand import dispatch&lt;BR /&gt;
from splunklib.searchcommand import  Confiuration&lt;BR /&gt;
...&lt;BR /&gt;
And so on&lt;/P&gt;

&lt;P&gt;It's looking for a .conf file with a section called handlers... Example:&lt;/P&gt;

&lt;P&gt;[handlers]&lt;BR /&gt;
Key=value&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 19:56:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274748#M3440</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-02-02T19:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Splunk SDK for Python custom streaming search command?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274749#M3441</link>
      <description>&lt;P&gt;Thanks, just figured that part out on my own I think. Does anyone have an example of a streaming command that actually does something? I'm not sure what the syntax is for modifying events in the "def stream(self, events):" function. Having pass in there doesn't seem to work.... the web interface is throwing: TypeError at "/opt/splunk/etc/apps/ip_asn/bin/splunklib/searchcommands/internals.py", line 519 : 'NoneType' object is not iterable&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 19:59:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274749#M3441</guid>
      <dc:creator>kcnolan13</dc:creator>
      <dc:date>2017-02-02T19:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Splunk SDK for Python custom streaming search command?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274750#M3442</link>
      <description>&lt;P&gt;Never mind, figured it out. Just need to iterate over events and yield each one.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 20:03:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274750#M3442</guid>
      <dc:creator>kcnolan13</dc:creator>
      <dc:date>2017-02-02T20:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Splunk SDK for Python custom streaming search command?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274751#M3443</link>
      <description>&lt;P&gt;Solution was to simply add this to logging.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[handlers]
keys = app, splunklib, stderr
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Feb 2017 20:05:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274751#M3443</guid>
      <dc:creator>kcnolan13</dc:creator>
      <dc:date>2017-02-02T20:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Splunk SDK for Python custom streaming search command?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274752#M3444</link>
      <description>&lt;P&gt;Where is this logging.conf file?&lt;BR /&gt;
Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 04:15:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274752#M3444</guid>
      <dc:creator>mrgibbon</dc:creator>
      <dc:date>2018-06-07T04:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Splunk SDK for Python custom streaming search command?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274753#M3445</link>
      <description>&lt;P&gt;'logging.conf' file should be under "$SPLUNK_HOME/etc//default" folder&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 06:17:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274753#M3445</guid>
      <dc:creator>jawaharas</dc:creator>
      <dc:date>2018-10-04T06:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve Splunk SDK for Python custom streaming search command?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274754#M3446</link>
      <description>&lt;P&gt;Never change files in /etc/system/default&lt;/P&gt;

&lt;P&gt;Put it in $splunk_home/etc/apps/appName/local&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 06:31:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-resolve-Splunk-SDK-for-Python-custom-streaming-search/m-p/274754#M3446</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2018-10-04T06:31:08Z</dc:date>
    </item>
  </channel>
</rss>

