简体   繁体   English

用户标识未打印在Apache访问日志中

[英]userid is not printed in Apache access logs

I have a production setup as 我有一个生产设置

  webSEAL --> F5 --> 2 Apache --- 2 weblogic servers.

For every request webSEAL logs prints logged-in user-id and weblogic which is at the very last in infrastructure chain also have the user-id available in weblogic http access.log (not application log but weblogic internal access logs) but there's nothing shown in Apache. 对于每个请求,webSEAL日志都会打印登录的用户ID,而位于基础架构链最后的weblogic在weblogic http access.log(不是应用程序日志,而是weblogic内部访问日志)中也具有可用的用户ID,但未显示任何内容在Apache中。

Even when I added new logging configuration at apache, it's not printing the user_id in apache access logs.It just print a dash - (information not available). 即使我在apache上添加了新的日志记录配置,它也不在apache访问日志中打印user_id,而只是打印一个破折号-(信息不可用)。

following is the added configuration in httpd.conf and output. 以下是httpd.conf和输出中添加的配置。

LogFormat "%h %V %u %t \"%r\" %>s" test
CustomLog logs/testLogs testFormat

***192.168.44.53 localhost - [11/Jun/2015:23:21:39 +0200] "HEAD / HTTP/1.1" 200*** 

What else do I need to do to "make user-id available to Apache instance". 我还需要做些什么来“使用户ID可用于Apache实例”。

This is the reference for Apache 2.0X which I'm using in my environment. 这是我在环境中使用的Apache 2.0X的参考。 http://httpd.apache.org/docs/2.0/logs.html http://httpd.apache.org/docs/2.0/logs.html

The %u pattern code logs the remote username if the request was authenticated with HTTP Basic or Digest authentication. 如果请求已通过HTTP Basic或Digest认证进行了认证,则%u模式代码将记录远程用户名。 In the example log entry this value is "-", meaning that the request was not authenticated with HTTP Basic or Digest authentication. 在示例日志条目中,该值为“-”,表示该请求未使用HTTP Basic或Digest身份验证进行身份验证。

You can use Apache to log client IP addresses utilizing X-Forwarded-For headers . 您可以使用Apache通过X-Forwarded-For标头记录客户端IP地址。

The standard LogFormat directive: LogFormat “%h %l %u %t “%r” %>s %b” common 标准的LogFormat指令:LogFormat“%h%l%u%t“%r”%> s%b”通用

To add the clients source IP address, just change this to: LogFormat “%h %l %u %t “%r” %>s %b %{X-Forwarded-For}i” common 要添加客户端源IP地址,只需将其更改为:LogFormat“%h%l%u%t“%r”%> s%b%{X-Forwarded-For} i”

Standard logs: 192.168.2.210 – – [09/Feb/2011:09:59:31 +0000] “GET / HTTP/1.1″ 200 44 标准日志:192.168.2.210 – – [09 / Feb / 2011:09:59:31 +0000]“ GET / HTTP / 1.1” 200 44

Client IP's added: 192.168.2.210 – – [09/Feb/2011:10:00:16 +0000] “GET / HTTP/1.1″ 200 44 192.168.2.7 客户端IP已添加:192.168.2.210 – – [09 / Feb / 2011:10:00:16 +0000]“ GET / HTTP / 1.1” 200 44 192.168.2.7

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM