Developing for Splunk Enterprise

Pyton SDK custom command runing distributed instead of local only

Loves-to-Learn Lots

I have written a generating custom command which generates just one event containing the session token and the search head it runs. This two parameters are then passed to another custom command which runs distributed on the indexers and needs them to call back to the search head.

I am on Splunk Enterprise, Version: 8.0.3 with Splunk Python SDK 1.6.12, single search head and 96 node indexer cluster.

The python script of the command starts with


from __future__ import absolute_import, division, print_function, unicode_literals

import os,sys
import time

splunkhome = os.environ['SPLUNK_HOME']
sys.path.append(os.path.join(splunkhome, 'etc', 'apps', 'searchcommands_app', 'lib'))
from splunklib.searchcommands import dispatch, GeneratingCommand, Configuration, Option, validators

@Configuration(streaming=True, local=True)
class callbackconnection(GeneratingCommand): 



The definition of the command in commands.conf is:


filename =
# python.version=python3
chunked = true



This command runs fine while using python 2.x but as soon as python.version=python3 is active in the definition of the command in commands.conf, the command gets distributed to the indexers an returns 97 results.

I tried various  @configuration(....) settings, but with python 3 the command is always distributed to the indexers.

Labels (2)
0 Karma

Splunk Employee
Splunk Employee

In addition to the above, I would recommend updating to 1.6.14+ of the Splunk Enterprise SDK for Python, since there are specific fixes for custom search commands in that version. 

0 Karma

Splunk Employee
Splunk Employee

By "above" I meant "fk319 's post" - sorry. 

0 Karma

0 Karma