1

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
  • Just to throw this out there -- Is SELinux enabled? If you disable it and then restart Apache does it work? – Safado May 30 '14 at 13:46
  • No, selinux is disabled. – Mike C May 30 '14 at 13:51
  • If I specify the full path it seems to work, but why is that required when the default path writes to the correct directory? (i.e /var/log/httpd/ssl_access...) – Mike C May 30 '14 at 14:03
3

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.

  • Thanks, that explains it then. I'd up vote you, but apparantly I can't yet. One more question if you don't mind. According to the docs if the location is not prefixed with a "/" then it will append to the server root which in my case is "/etc/httpd". But my logs (without rotatelogs) are written to /var/logs/httpd. Where is this specified? I am ok with the location, but the logic makes me thing they should be written to "/etc/httpd/logs". – Mike C May 30 '14 at 14:27
  • Typically /etc/httpd/logs is a symlink to ../../var/log/httpd :) For apache the logs files are written to the path /etc/httpd/logs/access_log but in reality they don't reside on your root partition, but on /var/log/httpd instead – HBruijn May 30 '14 at 14:29
  • I guess I missed that, thanks again for your help in helping me understand! – Mike C May 30 '14 at 14:56
  • Could the OP use something like TransferLog "|/usr/sbin/rotatelogs ${SERVER_ROOT}/logs/ssl_access_log.%Y-%m-%d.log 60"? – end-user Dec 21 '15 at 17:15
  • I don't know but that's easily tested (when one is not on mobile ) but I don't think the Apache internal variables are available to the sub shell that gets called to run rotatelogs – HBruijn Dec 21 '15 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.