Ubuntu 21.10 - Syslog.1 is 23GB in size!

Ubuntu 21.10 (upgraded from 18.04 to 20.04 to 21.04 to 21.10)

I installed Ubuntu back in November to learn the OS and noticed today that a major chunk of my SSD is taken over by a single syslog file.

/var/log/syslog.1 is 23 GB

/var/log/journal is 4 GB

I tried looking for solutions online and in one thread a user asked to open the syslog's tail to see what's causing the overflow of data into the file causing it to be so huge in size.

Every 6 seconds this gets added to the end of the log:

IPv6: MLD: clamping QRV from 1 to 2!

I'd like to limit the size of the syslog file to a certain size (let's say 5 GB). If something more needs to be done (like preventing the same IPv6 line endlessly getting added to the file), please advise on how to do so.

I'm still a novice user so please be patient with me.

Thanks


Solution 1:

This site explains how you can reduce the size of log files. Although written for Linux Mint, it is applicable for Ubuntu as well.

Reducing logs of systemd

  1. Reduce the current size of the systemd log files to 50 M with the command

    sudo journalctl --vacuum-size=50M

  2. Make the reduction permanent by editing /etc/systemd/journald.conf. Following command does that automatically.

    sudo sed -i 's/#SystemMaxFiles=100/SystemMaxFiles=7/g' /etc/systemd/journald.conf

Reduce the size of other logs

  1. Delete the current logs:

    sudo rm -v /var/log/*.log* /var/log/syslog*

  2. Then you make modifications to /etc/logrotate.d/rsyslog to keep only one previous group of archived logs rather than several, and increase the frequency of the rotation from weekly to daily:

    sudo sed -i 's/rotate 7/rotate 1/g' /etc/logrotate.d/rsyslog

    sudo sed -i 's/rotate 4/rotate 1/g' /etc/logrotate.d/rsyslog

    sudo sed -i 's/weekly/daily/g' /etc/logrotate.d/rsyslog

  3. Also logrotate is edited with a similar aim:

    sudo sed -i 's/rotate 4/rotate 1/g' /etc/logrotate.conf

    sudo sed -i 's/weekly/daily/g' /etc/logrotate.conf