Splunk Dev

Python logging in splunk

strive
Influencer

Hi,

I am trying to set file roll over for python.log file, similar to other splunk log files.

I found two links: http://dev.splunk.com/view/splunk-extensions/SP-CAAAEA9 and http://splunk-base.splunk.com/answers/80712/logging-from-python-in-splunk

These links are helpful. I was looking if it is possible to set the configurations in log-local.cfg file. I tried few options, but none worked.

Is it possible to define python logging configurations in log-local.cfg?

Thanks

Strive

Tags (2)
0 Karma
1 Solution

strive
Influencer

I looked into the script /opt/splunk/lib/python2.7/site-packages/splunk/__init__.py

From this it is clear that, we can not set any configurations other than level information in [python] stanza.

View solution in original post

nmistry_splunk
Splunk Employee
Splunk Employee

Unfortunately, in 5.0.x, splunk does not rotate python.log file and is not configurable. You can use a third party log rotation systems, however be careful they do not break Splunk indexing python.log file for its internal index.

0 Karma

strive
Influencer

I looked into the script /opt/splunk/lib/python2.7/site-packages/splunk/__init__.py

From this it is clear that, we can not set any configurations other than level information in [python] stanza.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

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