[php-maint] Bug#673558: logrotate for php5-fpm

Gedalya gedalya at gedalya.net
Sat May 19 16:00:42 UTC 2012


Package: php5-fpm
Version: 5.4.0-3
Severity: normal
Tags: patch

The php5-fpm package sets up a log file at /var/log/php5-fpm.log and it 
looks like there is nothing in place to rotate it.
This becomes more of a problem if you set catch_workers_output = yes 
which is kind of necessary for development, debugging or 
troubleshooting, but either way, leaving a log file unrotated is never 
the right thing.


--- php5-fpm.orig    2012-05-17 23:55:23.359974351 -0400
+++ /etc/init.d/php5-fpm    2012-05-18 00:00:01.632364075 -0400
@@ -141,6 +141,16 @@
      do_reload
      log_end_msg $?
      ;;
+    reopen-logs)
+        log_daemon_msg "Reopening $DESC logs" $NAME
+        if start-stop-daemon --stop --signal USR1 --oknodo --quiet \
+            --pidfile $PIDFILE --exec $DAEMON
+        then
+            log_end_msg 0
+        else
+            log_end_msg 1
+        fi
+        ;;
      restart)
      log_daemon_msg "Restarting $DESC" "$NAME"
      do_stop



# cat /etc/logrotate.d/php5-fpm
/var/log/php5-fpm.log {
         weekly
         missingok
         rotate 7
         compress
     delaycompress
         notifempty
         postrotate
              if [ -x /usr/sbin/invoke-rc.d ]; then \
                 invoke-rc.d php5-fpm reopen-logs > /dev/null 2>&1; \
              else \
                 /etc/init.d/php5-fpm reopen-logs > /dev/null 2>&1; \
              fi; \
         endscript
}






More information about the pkg-php-maint mailing list