Rotating files from RAM to storage for log rotation
In this section, we are going to discuss the logrotate Linux tool. Using this tool, administration of systems becomes easy. The systems generate large number of log files. This allows for automatic rotation, removal, compression, and mailing of log files.
We can handle each and every log file. We can handle them daily, weekly, and monthly. Using this tool, we can keep logs longer with less disk space. The default configuration file is /etc/logrotate.conf
. Run the following command to see the contents of this file:
$ cat /etc/logrotate.conf
You will see the following:
weekly rotate 4 create include /etc/logrotate.d # no packages own wtmp, or btmp -- we'll rotate them here /var/log/wtmp { missingok monthly create 0664 root utmp rotate 1 } /var/log/btmp { missingok monthly create 0660 root utmp rotate 1 } # system-specific logs may be configured here
Getting ready
To use logrotator, you must be aware of the logrotate...