/etc/init.d/apache2文件正在被日志旋转

我监视了一些奇怪的行为。 每周logrotate进程时,apache2守护进程脚本/etc/init.d/apache2被转动,就像它是一个日志文件一样。

第一周它创build了另一个文件apache2.1并清空了apache2。 接下来的一周,它做了apache2.2和apache2.1,并清空apache2。 等等。

-rwxr-xr-x 1 root root 6461 2015-04-26 06:25 apache2.4 -rwxr-xr-x 1 root root 6461 2015-05-03 06:25 apache2.3 -rwxr-xr-x 1 root root 6461 2015-05-10 06:25 apache2.2 -rwxr-xr-x 1 root root 6461 2015-05-17 06:25 apache2.1 -rwxr-xr-x 1 root root 0 2015-05-24 06:25 apache2 

我不知道这是一个Apache更新错误或一些计划的工作。 这是我的日志旋转文件:

 /var/log/apache2/*.log { weekly missingok rotate 52 compress delaycompress notifempty create 644 root adm sharedscripts postrotate if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`" ]; then /etc/init.d/apache2 reload > /dev/null fi endscript } 

我的apache2版本:2.2.12

编辑: logrotate.conf

 # see "man logrotate" for details # rotate log files weekly weekly # keep 4 weeks worth of backlogs rotate 4 # create new (empty) log files after rotating old ones create # packages drop log rotation information into this directory include /etc/logrotate.d # no packages own wtmp, or btmp -- we'll rotate them here /var/log/wtmp { missingok monthly create 0664 root utmp rotate 1 } /var/log/btmp { missingok monthly create 0660 root utmp rotate 1 } 

您可以检查/var/lib/logrotate.status文件中的logrotate。 如果存在关于旋转的任何作业,请检查/etc/cron.d/目录下的内容,或者检查/ var / log / cron log。 您可能会发现在/ etc目录中search包含apache2守护程序脚本的文件很有用:

  find /etc/ -type f -exec grep -H '/etc/init.d/apache2' {} \; 

我find了一个与/etc/logrotate.d/apache2_backup同样的path“ /etc/logrotate.d/apache2_backup ”的备份文件,它的内容与“ /etc/logrotate.d/apache2 ”的内容相同,在我将其移动到另一个位置并保留原来的位置之后,问题已修复。

仍然我不明白为什么2个文件具有相同的内容导致Apache守护进程文件logging旋转!