[CentOS] How to rotate PHP error log - since it belongs to apache

Alexander Farber alexander.farber at gmail.com
Tue Jun 5 14:15:26 UTC 2012


Hello Luigi and others,

On Tue, Jun 5, 2012 at 4:04 PM, Luigi Rosa <lists at luigirosa.com> wrote:
> Alexander Farber said the following on 05/06/12 15:57:
>
>> So my question is for how to rotate it (esp. since it should be owned by
>> "apache" user) - what do you guys use?
>
> the standard logrotate config /etc/logrotate.d/httpd or a modified copy of it
>
> since the rotation moves the old log and then reloads Apache, you don't have
> to worry about the ownership issue

yes, I'm aware of that file and have modified
the docs path in it because I have several vhosts too...

Here is my current /etc/logrotate.d/httpd file:

/var/log/httpd/my_vhost_1/*log {
    missingok
    notifempty
    sharedscripts
    delaycompress
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}

But my problem is I don't know how to do it best -
i.e. where to put the PHP log file
/var/log/php/php_errors.log
in the directives above and also how to rotate
the logs for all vhosts I have (I currently rotate just
for one - the "my_vhost_1" as you can see above)

Regards
Alex



More information about the CentOS mailing list