安装
centos下默认已安装了logrotate
rpm -ql logrotate-3.7.8-12.el6_0.1.x86_64
/etc/cron.daily/logrotate
/etc/logrotate.conf
/etc/logrotate.d
/usr/sbin/logrotate
/usr/share/doc/logrotate-3.7.8
/usr/share/doc/logrotate-3.7.8/CHANGES
/usr/share/doc/logrotate-3.7.8/COPYING
/usr/share/man/man5/logrotate.conf.5.gz
/usr/share/man/man8/logrotate.8.gz
/var/lib/logrotate.status
/etc/cron.daily/logrotate 此文件是定时脚本
/etc/logrotate.conf 此文件是全局配置文件
/etc/logrotate.d 此目录是存放单独定制的配置,我们创建的配置放这里
/usr/sbin/logrotate 二进制应用程序
配置
vi /etc/logrotate.d/mynginx
/var/log/xxx.log {
daily
rotate 30
dateext
dateformat -%Y%m%d%s
#compress
#delaycompress
missingok
notifempty
#create 600 www www
olddir arch
#minsize 200M