Splunk Dev

Custom Script and python 3.7 gives strange Loglevel Error

Elsurion
Communicator

Hi all

I've enabled the python 3.7 Support on my installation, but now my external command won't work anymore, saying i have some syntax error, which i'm not able to find in the binary tree of my command app...

And the command works with python 2.7...

The message is:

ValueError: Unknown level: 'ERROR ; Default: WARNING'

The full log is:

07-17-2020 10:12:48.713 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python3.7 /opt/splunk/etc/apps/elasticsplunk/bin/elasticsplunk.py __GETINFO__ eaddr=cluster1 index=testdrive query="state:IL or state=TN and age>22"':

Traceback (most recent call last):
File "/opt/splunk/etc/apps/elasticsplunk/bin/elasticsplunk.py", line 49, in <module>
from splunklib.searchcommands import dispatch, StreamingCommand, GeneratingCommand, Configuration, Option, validators
File "/opt/splunk/etc/apps/elasticsplunk/bin/splunklib/searchcommands/__init__.py", line 145, in <module>
from .environment import *
File "/opt/splunk/etc/apps/elasticsplunk/bin/splunklib/searchcommands/environment.py", line 120, in <module>
splunklib_logger, logging_configuration = configure_logging('splunklib')
File "/opt/splunk/etc/apps/elasticsplunk/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 80, in fileConfig
_install_loggers(cp, handlers, disable_existing_loggers)
File "/opt/splunk/lib/python3.7/logging/config.py", line 195, in _install_loggers
log.setLevel(level)
File "/opt/splunk/lib/python3.7/logging/__init__.py", line 1353, in setLevel
self.level = _checkLevel(level)
File "/opt/splunk/lib/python3.7/logging/__init__.py", line 192, in _checkLevel
raise ValueError("Unknown level: %r" % level)
ValueError: Unknown level: 'ERROR ; Default: WARNING'
07-17-2020 10:12:48.725 ERROR script - Getinfo probe failed for external search command 'ess'.

 

 

Labels (2)

peterezzo
Engager

Per https://docs.splunk.com/Documentation/SA-LdapSearch/3.0.2/User/UseSA-ldapsearchtotroubleshootproblem...

Your app's logging.conf file has a line like this in it:
level ERROR ; Default: WARNING

And it needs to look like this:
level ERROR

0 Karma

richgalloway
SplunkTrust
SplunkTrust
Did you run the Splunk Platform Upgrade Readiness App (https://splunkbase.splunk.com/app/4698/) ? It should have identified this before you upgraded. It might have identified the change that needed to be made to support Python 3.
---
If this reply helps you, Karma would be appreciated.
0 Karma

Elsurion
Communicator

Hi

I've executed the readyness tool but it had only warnings and not a single blocker.
Including the splunklib which should be ready for 3....

That's why i have no clue why the logger breaks. Every other point where the syntax changed yes, but not in the logger.

0 Karma

guilmxm
Influencer

@Elsurion 

Came to this thread randomly for the same needs (elasticsearch Python)
I just got rid of the logging.conf and that fixes import issues in 8.2.x

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...