It seems the journal files in my Ubuntu 18 LTS server are not compressed despite compression is enabled by default (I did not change it in /etc/systemd/journald.conf
) and journalctl
claims to see compressed files:
# journalctl --header | grep PRESS | uniq
Incompatible Flags: COMPRESSED-LZ4
# journalctl --disk-usage
Archived and active journals take up 4.0G in the file system.
# journalctl -o verbose | wc
4 GB in 90 Mio lines # about the same size as the journal files itself
# journalctl -o verbose | gzip | wc -c
193 MB # reduced by a factor of 20
grep -v '^#' /etc/systemd/journald.conf
[Journal]
Storage=persistent
SystemMaxUse=4G
SystemKeepFree=4G
SystemMaxFileSize=100M
MaxFileSec=1week
SyncIntervalSec=1
LineMax=1K
ForwardToConsole=yes
MaxLevelConsole=crit
MaxLevelWall=alert
RateLimitIntervalSec=2min
RateLimitBurst=2000
When I try to compress one of the /var/log/journal/*/*.journal
files I see a reduction by a factor of 5 while I know that already compressed data cannot be compressed by another compressor, so these files seem to be uncompressed.
How can I get systemd-journald
to compress my journal ?
Systemd doesn't appear to apply compression to the whole log file, but selectively to blocks of data within the log. This is inferior to wholesale compression as you found out yourself. The issue was brought up to the developers.