美文网首页
logrotate配置相关

logrotate配置相关

作者: RaferYY | 来源:发表于2018-11-05 14:57 被阅读0次

新配了ng的机器磁盘告警,发现自己丢上去的ng并没有配logrotate,搜了下配置加上大概这样
1、创建一个logrotate配置文件丢到/etc/logrotate.d/

/opt/verynginx/openresty/nginx/logs/*log {
    daily    #logrotate周期 
    rotate 4    #保存多久
    missingok    
    notifempty     #如果是空文件的话,不转储
    compress
    sharedscripts
    postrotate
        /bin/kill -USR1 $(cat /var/run/nginx.pid 2>/dev/null) 2>/dev/null || :
    endscript
}

2、logrotate -d /etc/logrotate.conf 测试一下。done。

相关文章

网友评论

      本文标题:logrotate配置相关

      本文链接:https://www.haomeiwen.com/subject/jjssxqtx.html