0

我在进行设置时遇到了问题

     logrotate.conf

我已经完成了一次设置,但它没有相应地工作。

主要条件是每隔 5 天循环压缩日志文件

 /var/log/humble/access.log
     { 

        daily
        copytruncate
        rotate 5
         create 755 humble humble
         dateext
         compress
         include /etc/logrotate.d/humble/
    }

即使在这样做之后,几天后压缩也会停止。

4

1 回答 1

0

Your logrotate.conf file should have mention to include your file "humble":-

include /etc/logrotate.d/humble

#End of Logrotate.conf

and then in your /etc/logrotate.d/humble

/var/log/humble/access.log
 { 

    daily
    copytruncate
    rotate 5
    create 755 humble humble
    dateext
    compress

}

The number specified after rotate gives how many files to be kept for backup after rotation. Here it is 5.

Also, you need to add a rule in the crontab file for triggering the logrotate every 5 days.

Rule in crontab file for running it every 5 days is :-

0 0 */5 * *
于 2013-12-24T09:59:49.970 回答