我需要更改apache的日志保留,目前似乎是运行在每周一次的logrotate.conf中。 它会为每周创build“access_log.1”,“access_log.2”等等。 问题是每个星期删除最后一个日志文件'access_log.5',我需要日志继续无限期而不是每周最后一次删除日志。 它似乎运行在logrotate.conf的默认值 – 我不想更改该文件中保存的默认值,所以我认为有一种方法来改变保留使用/etc/logrotate.d/httpd文件?
内容如下:
/var/log/httpd/*log { missingok notifempty sharedscripts postrotate /sbin/service httpd reload > /dev/null 2>/dev/null || true endscript }
我可以添加/更改什么来停止每周最后一次被删除的日志?
你需要添加rotate {value}选项来告诉logrotate要保留多less个副本。 下面将保留52份。
/var/log/httpd/*log { missingok rotate 52 notifempty sharedscripts postrotate /sbin/service httpd reload > /dev/null 2>/dev/null || true endscript }