nginx日志分割

定时任务

0 0 * * *  /usr/sbin/logrotate -f /etc/logrotate.d/nginx

/etc/logrotate.d/nginx文件

/letv/logs/nginx/api.pv.log /letv/logs/nginx/boss.pv.log{
daily
dateext
maxage 60
rotate 60
missingok
sharedscripts
postrotate
if [ -f /usr/local/nginx/logs/nginx.pid ]; then
kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`
fi
endscript
}

猜你喜欢

转载自weiboxie.iteye.com/blog/2194753