Search code examples
log-rotationsystemd-journald

Journald SystemMaxUse when machine-id changes


I am using journald on an embedded system for logging to a persistant drive. The maximum stored logs are limited using the config parameter SystemMaxUse= and log rotation enabled. This works fine, until the systemd machine-id changes during software update (we flash a full system image during software update, very typical in embedded systems).

With the new machine-id journald creates a new log folder name, and ignores all previous folders. Hence the rotation mechanism ignores logs from other machine-id's and my quota is exceeded.

Does anybody know, how to include other machine-id logs into journald log rotation? Thanks...

Side note: With journalctl --merge I can read logs from other machine-id stored in the same journald log path, however the --merge option is ignored with cleanup commands like journalctl --rotate and/or jorunalctl --vacuumsize=1G


Solution

  • This is so late but i have encountred exactly the same issue, the solution that i came with is: at the end of OS update i rename the existing log folders with the new machine-id, now i have no issue with that and old logs are taken into account when system rotate