Splunk Dev

Parsing logs from Python Docker container sent to Splunk HEC

reallyliri
Explorer

I'm sending all my docker containers logs to my local Splunk server.

One of these containers is running a Python server (using Flask/nginx).

For debugging and log file reasons, my Python logs are foramtted with a standard line: %(asctime)s - %(name)s - %(levelname)s - %(message)s

I can see the log line clearly in Splunk, however, I would also want to parse the timestamp, log-level etc. In addition, it seems that stack traces are split to multiple messages.

screenshot

Note that not all messages from the host sent to this server are from Python, but the other ones don't require additional formatting.

So:

  • How can I configure Splunk to parse my messages according to my log format?

  • How can I merge the stack trace logs to a single message (I'm guessing that it should be done on consuming)

  • Can I define formatting for the Python messages without damaging the 'other' messages?

0 Karma
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...