The log files size must be controlled because their size always grows over time. Each system has limited resources, and too large logs lead to performance and memory problems. Linux solves this problem with a concept called logrotate. **The logrotate is the system daemon that rotates, compresses, and mails system logs.
This tutorial shows you how to:
You will need:
sudo
access.System logs in Ubuntu 20.04 with a default configuration maintains the daemon logrotate
. This daemon uses configuration files that specify all rotation details for each application. The configuration consist of the following parts:
/etc/logrotate.conf
: This is a most general configuration file with default setup./etc/logrotate.d
: This is a directory that includes files for specific application rotation. Each such application has there own configuration file. Otherwise, application logs use general configuration.We will view both configuration possibilities.
As first, let's view more general configuration file /etc/logrotate.conf
.
Print the content of file /etc/logrotate.conf
with utility cat:
$ cat /etc/rsyslog.conf