from splunklib.searchcommands import dispatch, GeneratingCommand, Configuration
sdk installed with (Centos 8):
pip3 install -t . splunk-sdk
[root@splunk bin]# /opt/splunk/bin/python3 ./test.py
Traceback (most recent call last):
File "./test.py", line 1, in
from splunklib.searchcommands import dispatch, GeneratingCommand, Configuration
File "/opt/splunk/etc/apps/test/bin/splunklib/searchcommands/init.py", line 145, in
from .environment import *
File "/opt/splunk/etc/apps/test/bin/splunklib/searchcommands/environment.py", line 120, in
splunklib_logger, logging_configuration = configure_logging('splunklib')
File "/opt/splunk/etc/apps/test/bin/splunklib/searchcommands/environment.py", line 103, in configure_logging
fileConfig(filename, {'SPLUNK_HOME': splunk_home})
File "/opt/splunk/lib/python3.7/logging/config.py", line 79, in fileConfig
handlers = _install_handlers(cp, formatters)
File "/opt/splunk/lib/python3.7/logging/config.py", line 126, in _install_handlers
hlist = cp["handlers"]["keys"]
File "/opt/splunk/lib/python3.7/configparser.py", line 958, in getitem
raise KeyError(key)
KeyError: 'handlers'
Hello.
Import of the sdk doesn't work.
Simple test.py with:
from splunklib.searchcommands import dispatch, GeneratingCommand, Configuration
sdk installed with (Centos 8): pip3 install -t . splunk-sdk
[root@splunk bin]# /opt/splunk/bin/python3 ./test.py Traceback (most recent call last): File "./test.py", line 1, in
from splunklib.searchcommands import dispatch, GeneratingCommand, Configuration
File "/opt/splunk/etc/apps/test/bin/splunklib/searchcommands/init.py", line 145, in
from .environment import *
File "/opt/splunk/etc/apps/test/bin/splunklib/searchcommands/environment.py", line 120, in
splunklib_logger, logging_configuration = configure_logging('splunklib')
File "/opt/splunk/etc/apps/test/bin/splunklib/searchcommands/environment.py", line 103, in configure_logging
fileConfig(filename, {'SPLUNK_HOME': splunk_home})
File "/opt/splunk/lib/python3.7/logging/config.py", line 79, in fileConfig
handlers = _install_handlers(cp, formatters)
File "/opt/splunk/lib/python3.7/logging/config.py", line 126, in _install_handlers
hlist = cp["handlers"]["keys"]
File "/opt/splunk/lib/python3.7/configparser.py", line 958, in getitem
raise KeyError(key)
KeyError: 'handlers'