[root@qianduan pang]# cat /etc/logrotate.d/nginx 
/usr/local/nginx/logs/*log { 
monthly 

size=1000M

missingok 
rotate 99 
create 
compress 

delaycompress
notifempty 
sharedscripts 
postrotate 
[ -f /usr/local/nginx/logs/nginx.pid ] && kill -USR1 `cat /usr/local/nginx/logs/nginx.pid` 
endscript 
}

注释:
/usr/local/nginx/logs/*log :需要轮询日志路径
monthly :每月轮询  其它可用值为‘daily’,‘weekly’或者‘yearly’。

size:大于指定大小才轮询

missingok:如果日志丢失,不报错继续滚动下一个日志
rotate 99:保留最多30次滚动的日志

create: 创建新文件 
notifempty:当日志为空时不进行滚动
compress:旧日志默认用gzip压缩

delaycompress: 总是与compress选项一起用,delaycompress选项指示logrotate不要将最近的归档压缩,压缩将在下一次轮循周期进行。这在你或任何软件仍然需要读取最新归档时很有用。

postrotate/endscript: 在所有其它指令完成后,postrotate和endscript里面指定的命令将被执行。在这种情况下,rsyslogd 进程将立即再次读取其配置并继续运行


/usr/local/nginx/logs/nginx.pid :nginx主进程pid