Managing log files effectively is an essential task for Linux sysadmin.
In this article, let us discuss how to perform following log file operations using UNIX logrotate utility.
- Rotate the log file when file size reaches a specific size
- Continue to write the log information to the newly created file after rotating the old log file
- Compress the rotated log files
- Specify compression option for the rotated log files
- Rotate the old log files with the date in the filename
- Execute custom shell scripts immediately after log rotation
- Remove older rotated log files
Logrotate is a utility designed for administrators who manage servers producing a high volume of log files to help them save some disk space as well as to avoid a potential risk making a system unresponsive due to the lack of disk space. Normally, a solution to avoid this kind of problem is to setup a separate partition or logical volume for a /var mount point. However, logrotate may also be a viable solution to this problem especially if it is too late to move all logs under different partition. In this article we will talk about usage and configuration of logrotate on RedHat / CentOS Linux server. 继续阅读
系统管理员可以使用logrotate 程序用来管理系统中的最新的事件。logrotate 还可以用来备份日志文件，本篇将通过以下几部分来介绍