Your question
I am running Stalwart 0.16.14 in a Docker container, and I was wondering if there was any way to automatically compress rotated logs?
No, Stalwart’s built-in log-file tracer does not have a compression option. The Log tracer only supports path, prefix, and rotate (daily/hourly/minutely/never), with no compression setting for rotated files.
If you want compressed rotated logs, the usual approach is to run Stalwart with Console log output in Docker (letting Docker’s logging driver, e.g. json-file with compression, or local driver, handle rotation/compression) rather than using Stalwart’s own file rotation, or to run an external tool like logrotate against the log directory outside the container.
This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.
As I have my logs in /var/lib/stalwart/log/ I have scheduled the command
docker exec -u stalwart stalwart find 'log/' -type f -name 'stalwart*' -not \( -name '*.gz' -or -name "*`date +%F`" \) -exec gzip -9 {} \;
to run once a day with cron