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!

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...

New Articles from Academic Learning Partners, Help Expand Lantern’s Use Case Library, ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...