如何为x-forwardlogging器configurationApache httpd.conf

我想configuration我的httpd.conf来查看客户端IP地址和一些更多的信息。 这是我有:

LogLevel warn LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded` CustomLog "logs/access_log" combined env=!forwarded CustomLog "logs/access_log" proxy env=forwarded CustomLog /var/log/httpd/access_log combined env=!dontlog 

所有我可以看到,当我做tail -f /var/log/httpd/access.log是:

 combined combined 

每时每刻。 我究竟做错了什么?

谢谢! 多坦。

combined未在您提供的configuration中configuration为LogFormat – 因此不是将LogFormat应用于文件,而是将其combined为字面格式string。

您需要设置一个LogFormat进行combined才能正常工作。

只需安装mod_rpaf ,更改configuration文件以允许代理的IP,并且您应该在日志文件上获取客户端的IP,而不对日志格式进行任何更改。