我正在尝试将我所有的 apache 日志发送到 syslog-ng(在远程机器上),后者又写入一个文件。
所以我这样配置syslog-ng
source s_apache {
unix-stream("/var/log/apache_log.socket" max-connections(512) keep-alive(yes));
};
filter f_apache { match("error"); };
destination df_custom { file("/var/log/custom.log"); };
log {
source(s_apache);
filter(f_apache);
destination(df_custom);
};
并将以下行添加到 apache2.conf
ErrorLog "|/usr/bin/logger -t 'apache' -u /var/log/apache_log.socket"
但只有写入“/var/log/custom.log”的日志是
[Mon Jul 13 17:24:36 2009] [notice] caught SIGTERM, shutting down
和
[Mon Jul 13 17:26:11 2009] [notice] Apache/2.2.11 (Ubuntu) configured -- resuming normal operations
我希望所有日志都发送到 custom.log..... 请帮助我....我哪里错了?
我可以向您推荐这个链接: http://httpd.apache.org/docs/2.2/logs.html 在这里您可以了解有关登录 apache 的信息。 如果你想要所有日志都在 syslog-ng 上,你还必须使用 CustomLog 指令配置访问日志。
问候, 洛伦佐
我有同样的问题,我发现 ErrorLog 和 CustomLog 设置被 /etc/apache2/sites-available/default 覆盖了
注释掉那些之后,它起作用了!
或者如果您只想记录特定的域调用,您可以将这些设置放在< virtualhost >中
问候 雷恩