Centos – Apache HTTPd – rotatelogs not working

apache-2.2centoshttpdhttpd.conf

I've edited my conf.d/ssl.conf file and changed the TransferLog directive from:

TransferLog logs/ssl_access_log

to

TransferLog "|/usr/sbin/rotatelogs logs/ssl_access_log.%Y-%m-%d.log 60" 

(I am using 60 seconds for testing)

Since that change and an httpd restart my original ssl_access_log is not updating and a new log was not generated. What am I missing?

in my error log, I am receiving this message

Could not open log file 'logs/ssl_access_log.2014-05-30.log' (No such file or directory)
piped log program '/usr/sbin/rotatelogs logs/ssl_access_log.%Y-%m-%d.log 60' failed unexpectedly

Best Answer

rotatelogs requires a full path.

Prepending the ServerRoot to relative paths (i.e those not not starting with a / or driveletter:\) happens only within Apache and external programs such as rotatelogs are not aware of Apache's ServerRoot variable.