Bug 773077 - php-fpm: buggy(?) logrotate config
Summary: php-fpm: buggy(?) logrotate config
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: php
Version: 16
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Remi Collet
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-01-10 20:55 UTC by Anton Arapov
Modified: 2014-06-18 08:03 UTC (History)
5 users (show)

Fixed In Version: php-5.3.9-1.fc16
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-01-19 22:00:02 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Anton Arapov 2012-01-10 20:55:50 UTC
Description of problem:
logrotate doesn't rotate php-fpm log after clear install of f16

Version-Release number of selected component (if applicable):
# rpm -q php-fpm
php-fpm-5.3.8-3.fc16.x86_64

How reproducible:
- default configuration of logrotate, iow nothing has been touched.

# logrotate -d /etc/logrotate.conf /etc/logrotate.d/php-fpm 

Actual results:

rotating pattern: /var/log/php-fpm/*log  weekly (4 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/php-fpm/error.log
error: skipping "/var/log/php-fpm/error.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
considering log /var/log/php-fpm/www-error.log
error: skipping "/var/log/php-fpm/www-error.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
not running postrotate script, since no logs were rotated

Expected results:
rotating pattern: /var/log/php-fpm/*log  weekly (4 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/php-fpm/error.log
  log needs rotating
considering log /var/log/php-fpm/www-error.log
  log needs rotating
rotating log /var/log/php-fpm/error.log, log->rotateCount is 4
dateext suffix '-20120110'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding old rotated logs failed
rotating log /var/log/php-fpm/www-error.log, log->rotateCount is 4
dateext suffix '-20120110'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding old rotated logs failed
fscreate context set to system_u:object_r:var_log_t:s0
renaming /var/log/php-fpm/error.log to /var/log/php-fpm/error.log-20120110
creating new /var/log/php-fpm/error.log mode = 0600 uid = 0 gid = 0
fscreate context set to system_u:object_r:var_log_t:s0
renaming /var/log/php-fpm/www-error.log to /var/log/php-fpm/www-error.log-20120110
creating new /var/log/php-fpm/www-error.log mode = 0644 uid = 48 gid = 48
running postrotate script
running script with arg /var/log/php-fpm/*log : "
	/bin/kill -SIGUSR1 `cat /var/run/php-fpm/php-fpm.pid 2>/dev/null` 2>/dev/null || true
"

Comment 1 Anton Arapov 2012-01-10 20:57:11 UTC
Fix for this is to add 'su' directive to the php-fpm config of logrotate.d

i.e.

/var/log/php-fpm/*log {
    su
    missingok
    notifempty
    sharedscripts
    delaycompress
    postrotate
        /bin/kill -SIGUSR1 `cat /var/run/php-fpm/php-fpm.pid 2>/dev/null` 2>/dev/null || true
    endscript
}

but I don't know whether this is the way to go...

Comment 2 David Nalley 2012-01-11 14:46:59 UTC
Anton, 

This looks like it's assigned to the wrong component. (it's currently assigned to php-fpdf - which has nothing to do with what php-fpm does. Reassigning to php

Comment 3 Remi Collet 2012-01-11 16:32:43 UTC
I will change owner to root on next update (php 5.3.9)

Comment 4 Fedora Update System 2012-01-11 20:00:17 UTC
php-5.3.9-1.fc16,maniadrive-1.2-32.fc16.1,php-eaccelerator-0.9.6.1-9.fc16.1 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/php-5.3.9-1.fc16,maniadrive-1.2-32.fc16.1,php-eaccelerator-0.9.6.1-9.fc16.1

Comment 5 Fedora Update System 2012-01-15 20:07:15 UTC
Package php-5.3.9-1.fc16, maniadrive-1.2-32.fc16.1, php-eaccelerator-0.9.6.1-9.fc16.1:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing php-5.3.9-1.fc16 maniadrive-1.2-32.fc16.1 php-eaccelerator-0.9.6.1-9.fc16.1'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-0504/php-5.3.9-1.fc16,maniadrive-1.2-32.fc16.1,php-eaccelerator-0.9.6.1-9.fc16.1
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2012-01-19 22:00:02 UTC
php-5.3.9-1.fc16, maniadrive-1.2-32.fc16.1, php-eaccelerator-0.9.6.1-9.fc16.1 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.