conf文件说的是什么:
$cat /etc/logrotate.d/apache2/var/log/apache2/*.log { weekly missingok rotate 2 compress delaycompress notifempty create 640 root adm sharedscripts postrotate /etc/init.d/apache2 reload > /dev/null endscript}
日志文件夹的(裁剪)内容:
# ls /var/log/apache2/access.log error.log.26.gz other_vhosts_access.log.20.gz access-ssl.log.14.gzaccess.log.1 error.log.27.gz other_vhosts_access.log.21.gz access-ssl.log.15.gzaccess.log.2.gz error.log.28.gz other_vhosts_access.log.22.gz access-ssl.log.16.gzaccess.log.3.gz error.log.2.gz other_vhosts_access.log.23.gz access-ssl.log.17.gz[...]
实际上有很多:
# ls /var/log/apache2/ | wc -l85
使用–verbose的logrotate命令给了我:
# /usr/sbin/logrotate --verbose /etc/logrotate.conf[...]reading config file apache2reading config info for /var/log/apache2/*.log[...]rotating pattern: /var/log/apache2/*.log weekly (2 rotations)empty log files are not rotated,old logs are removedconsIDering log /var/log/apache2/access.log log does not need rotatingconsIDering log /var/log/apache2/error.log log does not need rotatingconsIDering log /var/log/apache2/other_vhosts_access.log log does not need rotatingconsIDering log /var/log/apache2/pbpdhg-ssl.log log does not need rotatingnot running postrotate script,since no logs were rotated[...]
这有什么不对?
日志是否已旋转但未被删除?
我错过了什么?
这意味着日志文件在被删除之前会被旋转2次,因此logrotate只关注2个文件.
我的猜测是配置在某些时候发生了变化,因为以前保存了更多的日志文件,也许就像旋转28.这些旧文件你必须手动删除.
总结以上是内存溢出为你收集整理的linux – Logrotate不会删除旧日志全部内容,希望文章能够帮你解决linux – Logrotate不会删除旧日志所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)