$ cat /etc/logrotate.conf # see "man logrotate" for details # rotate log files weekly weekly # 每周转存一次 # keep 4 weeks worth of backlogs rotate 4 # 保留四个日志备份文件 # create new (empty) log files after rotating old ones create # rotate后,创建一个新的空文件 # use date as a suffix of the rotated file dateext # 轮转的文件名字带有日期信息 # uncomment this if you want your log files compressed #compress # RPM packages drop log rotation information into this directory include /etc/logrotate.d # 此目录下的配置文件优先生效 # no packages own wtmp and btmp -- we'll rotate them here /var/log/wtmp { # 指定/var/log/wtmp日志文件; monthly # 每月轮转一次,优先于全局设定的每周轮转一次; minsize 1M # 日志文件大于1M才会去轮转; create 0664 root utmp # 新日志文件的权限,属主,属组; rotate 1 # 保留一个日志备份,优先于全局设置的四个; } /var/log/btmp { # 指定/var/log/btmp日志文件; missingok # 如果日志丢失,不报错; monthly create 0600 root utmp rotate 1 } # system-specific logs may be also be configured here. # 系统特定的日志也可以在主文件中配置。