logrotate切割nginx日志

2019-10-30  本文已影响0人  夏2018

yum -y install logrotate



/opt/wisecloud/cloudstorage/cs_resty/software/cs_resty/logs/*.log {
daily
rotate 5
missingok
notifempty
create 0664 root utmp
olddir /opt/wisecloud/cloudstorage/cs_resty/software/cs_resty/logs/history_log
sharedscripts
postrotate
    if [ -f /opt/wisecloud/cloudstorage/cs_resty/software/cs_resty/logs/nginx.pid ]; then
        kill -USR1 `cat /opt/wisecloud/cloudstorage/cs_resty/software/cs_resty/logs/nginx.pid`
    fi
endscript
}

crontab -e
59 23 * * *  /usr/sbin/logrotate -f /etc/logrotate.d/nginx_log

每天23点59分进行日志滚动
上一篇 下一篇

猜你喜欢

热点阅读