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:

weeklyrotate 4create include /etc/logrotate.d# no packages own wtmp, or btmp -- we'll rotate them here/var/log/wtmp { missingok ...

Get Bash Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.