How to change docker logs format

As of now we have Spring boot applications which are running in docker containers - and the docker containers are adding the logs of the application in the below format i.e. the log written by the application is placed in the field called “log” and docker adds the other two fields stdout and timestamp.

Can any one suggest how to remove this additional meta data added by docker and instead have what ever logged by application in the logs as it is.

Docker log
{ “log”: “Some log data”, “stream”: “stdout”, “time”: “2022-03-15T22:56:36.376013325Z” }

Simple log
Some log data

Hi

You can send your logs to a syslog server and handle the log there:

How do you try to read the logs? When you run docker logs containername you won’t get any additional metadata. That is for internal use, so when you try to get the logs, docker can handle the streams correctly.

docker logs containername  2>err.log 1>out.log

echo Error messages:
cat err.log
echo

echo Other messages
cat out.log