Torizon Docker logs location

Hello,

i wanted to know in the torizon docker where are the logs of the container are stored ? and if there is a way to truncate them.
as per the info i have found online they should be here /var/lib/docker/containers/<container_id>/<container_id>-json.log
but in torizon there is no such log file here. Is there a alternate location where this is stored. doing docker logs does show me the complete log and i was wondering if overtime this can get to large sizes and create problems.

apalis-imx8-0654XXX:~/sbb$ sudo ls /var/lib/docker/containers/268e6f1230fa3ceab4d47ac738156e04af2a79389fc1eef77982335e5f77282f/
checkpoints  config.v2.json  hostconfig.json  hostname  hosts  mounts  resolv.conf

Greetings @nkj,

By default the Docker engine on Torizon uses the journald log driver, instead of the *json.log format. The log files exist in the format of /run/log/journal/<ID hash not equal to cotnainer ID>/system.journal. However these logs exist in a binary format and can’t be normally read/parsed by accessing the file directly.

For more info on the journald log driver for docker see here: https://docs.docker.com/config/containers/logging/journald/

Regarding your concern with log sizes. This is a valid concern and these logs can take up non-insignificant amounts of space if containers are left running for a long time. As for controlling log sizes you can use journalctl to manage all journald logs. Looking at the man page here: https://freedesktop.org/software/systemd/man/journalctl.html
There’s options for log pruning you can do here.

Out of curiosity have you already experienced issues with log size or such?

Best Regards,
Jeremias

Hi Jeremias

thanks for the answer. currently we haven’t run into a issue as we are still in the prototype phase. but in future in our application the system could be running for a couple of months between reboots so i was considering things that could cause problems.
i guess with the journald log driver the the max-file and max-size options in the docker-compose file should work too to limit the size of the files.

another question was as this is written to the built in emmc (imx8qm) do you think there could be any issues related to that in the long run (5-8 years lifetime)

1 Like

While all of our hardware is built to be rugged and long-lasting, the exact lifespan of eMMC heavily depends on use-case. Therefore I can’t confidently give you any estimates, as it depends on too many factors.

The best way would be to do rigorous testing on your specific use-case, while continually monitoring the eMMC. This might be able to give you a rough idea of the lifespan under your conditions.

We did do a webinar about flash systems that may also give you some needed information: https://www.toradex.com/webinars/flash-memory-in-embedded-linux-systems

Best Regards,
Jeremias