Apache HTTPd - 旋转日志不起作用

1 httpd centos httpd.conf apache-2.2

我已经编辑了我的 conf.d/ssl.conf 文件并将 TransferLog 指令从:

TransferLog logs/ssl_access_log
Run Code Online (Sandbox Code Playgroud)

TransferLog "|/usr/sbin/rotatelogs logs/ssl_access_log.%Y-%m-%d.log 60" 
Run Code Online (Sandbox Code Playgroud)

(我使用 60 秒进行测试)

由于该更改和 httpd 重新启动,我原来的 ssl_access_log 没有更新,也没有生成新日志。我错过了什么?

在我的错误日志中,我收到此消息

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
Run Code Online (Sandbox Code Playgroud)

HBr*_*ijn 5

rotatelogs 需要完整路径。

将 ServerRoot 加到相对路径(即那些不以 a/或开头的路径driveletter:\)只发生在 Apache 中,而外部程序(例如 rotatelogs)不知道 Apache 的 ServerRoot 变量。