Two things we'll get to play with here - logrotate and journald.conf. Note that both logrotate and journald.conf have man pages available in case you get stuck. Let's get to it
logrotate
logrotate looks for its configuration in /etc/logrotate.conf and /etc/logrotate.conf.d and the format is pretty simple. Below is an unmolested copy of logrotate.conf - check it out -
Code: Select all
# see "man logrotate" for details.
# global options do not affect preceding include directives
# rotate log files weekly
#weekly
# keep 4 weeks worth of backlogs
#rotate 4
# create new (empty) log files after rotating old ones
#create
# use date as a suffix of the rotated file
#dateext
# uncomment this if you want your log files compressed
#compress
# packages drop log rotation information into this directory
include /etc/logrotate.d
# system-specific logs may also be configured here.
Code: Select all
# see "man logrotate" for details
# global options do not affect preceding include directives
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 2
# create new (empty) log files after rotating old ones
create
# use date as a suffix of the rotated file
dateext
# uncomment this if you want your log files compressed
#compress
# packages drop log rotation information into this directory
include /etc/logrotate.d
You can see the last line in the file says "include /etc/logrotate.d" and if you take a look in that directory you'll see configurations for a few other logs - check it out - this is /etc/lograte.d/apt
Code: Select all
/var/log/apt/term.log {
rotate 2
weekly
compress
missingok
notifempty
}
/var/log/apt/history.log {
rotate 2
weekly
compress
missingok
notifempty
}
journald.conf
journald maintains binary logs that can be accessed with journalctl. /etc/systemd/journald.conf is a little more complex than logrotate configs so I've linked to https://www.freedesktop.org/software/sy ... .conf.html so folks can get a better understanding of what goes on under the hood. Check this out -
Code: Select all
[Journal]
#Storage=auto
#Compress=yes
#Seal=yes
#SplitMode=uid
#SyncIntervalSec=5m
#RateLimitIntervalSec=30s
#RateLimitBurst=10000
SystemMaxUse=1G
#SystemKeepFree=
#SystemMaxFileSize=
#SystemMaxFiles=100
#RuntimeMaxUse=
#RuntimeKeepFree=
#RuntimeMaxFileSize=
#RuntimeMaxFiles=100
#MaxRetentionSec=0
#MaxFileSec=1month
#ForwardToSyslog=no
#ForwardToKMsg=no
#ForwardToConsole=no
#ForwardToWall=yes
#TTYPath=/dev/console
#MaxLevelStore=debug
#MaxLevelSyslog=debug
#MaxLevelKMsg=notice
#MaxLevelConsole=info
#MaxLevelWall=emerg
#MaxLevelSocket=debug
#LineMax=48K
#ReadKMsg=yes
#Audit=yes
The changes I made above reduced the size of my logs from a little more than 3GB to 1.2GB. As mentioned logrotate and journald.conf are well-documented but I would recommend backing up the default files before hacking away at them.
Enjoy!