C:\Program Files\Tomcat-6.0.20\conf
配置server.xml 新增如下:
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="zhuangzhuang_access_log." suffix=".txt" pattern="%a %r %t %{X-Forwarded-For}i" resolveHosts="false"/>
日志目录如下
C:\Program Files\Tomcat-6.0.20\logs
zhuangzhuang_access_log.2020-05-07.txt
结果如下:
192.168.111.81 GET /myweb/index.htmlfavicon.ico HTTP/1.0 [07/May/2020:16:03:42 +0800] 10.10.102.81, 192.168.111.154, 192.168.111.16
10.10.102.81 是真实客户端地址
192.168.111.154, 192.168.111.16,192.168.111.81 分别为nginx1 ngin2 ngin3 代理服务器