Splunk Dev

Why am I unable to set up logging to debug my python script?

clorne
Communicator

Hello,

I am trying to activate the logging in order to debug my python script.
I have followed the documentation located at:
http://docs.splunk.com/Documentation/Splunk/6.3.0/AdvancedDev/ModInputsLog

SPLUNK_HOME/etc/log.cfg had already category.ExecProcessor=INFO

And the code is basically the same as the example:

set up logging suitable for splunkd consumption

logging.root
logging.root.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(levelname)s %(message)s')
handler = logging.StreamHandler(stream=sys.stderr)
handler.setFormatter(formatter)
logging.root.addHandler(handler)
logging.info("LOGGING INFO HELLO.")
logging.debug("LOGGING DEBUG HELLO")

My entry is not logged in SPLUNK_HOME/var/log/splunk/splunkd.log
I have no index=_internal ExecProcessor.
I found an index names splunklogger, but it does not contain any event.

Regards

0 Karma

MuS
Legend

Hi clorne,

did you import logging in your script as stated in the example?

cheers, MuS

0 Karma

clorne
Communicator

Hello MuS,
Yes I did.
Is the logging working correctly with the procedure provided by Splunk documentation?

Regards

0 Karma

MuS
Legend

Yes, that's the way to log events from your script into splunkd.log. Here is another example http://docs.splunk.com/Documentation/Splunk/6.3.0/AdvancedDev/ModInputsExample

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...