Splunk Dev

Splunk Enterprise Python SDK doesn't recognize custom search command

kmstepien
New Member

I have a test environment on my laptop. I get the following error:

Unknown search command 'mycommand'.

Details are:
- Using Splunk Enterprise 8.0.1 on macOS running Mojave
- Created a new app called python_sdk_app and revised permissions to “All apps”
- Installed Splunk SDK 1.6.11 in bin folder of the app using ‘pip install -t . splunk-sdk’
- Created commands.conf inside the default directory of the app (also tried the local directory)
- Restarted splunk

commands.conf file:
[mycommand]
chunked=true
filename=mycommand.py

package locations:
$ python -m site
sys.path = [
'/Applications/Splunk/splunk-sdk-python-1.6.11',
'/anaconda3/lib/python36.zip',
'/anaconda3/lib/python3.6',
'/anaconda3/lib/python3.6/lib-dynload',
'/anaconda3/lib/python3.6/site-packages',
'/anaconda3/lib/python3.6/site-packages/aeosa',
'/anaconda3/lib/python3.6/site-packages/splunk_sdk-1.6.11-py3.6.egg',
]

environment variables:
SHELL=/bin/bash
SPLUNK_HOME=/Applications/Splunk
PATH=/Library/Frameworks/Python.framework/Versions/3.6/bin:/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
PYTHONPATH=/Applications/Splunk/splunk-sdk-python-1.6.11

Labels (2)
0 Karma

kmstepien
New Member

My commands.conf file was not in the correct format (i.e. hidden characters). Once that issue was resolved, the mycommand.py file could not be found so I removed the filename=mycommand.py from the commands.conf file and everything worked. This was my first question to the forum - unsure how to close it. I see no option for rescinding the question.

0 Karma
Get Updates on the Splunk Community!

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...