Configuring logback.xml to log X-Forwarded-For/Client IP in audit logs in IdP v3
Khawer Masood
shehzada at gwu.edu
Tue Sep 22 15:55:47 EDT 2015
To capture the end user’s IP address in the audit logs, I have tried these patterns in conf/logback.xml without success:
1. <Pattern>%msg|%X{req.xForwardedFor}|%n</Pattern> — does not log anything in v3, but worked in Tomcat 6/IdP v2 (in conf/logging.xml) — see http://logback.qos.ch/manual/mdc.html#mis
2. <Pattern>%msg|%mdc{req.xForwardedFor}|%n</Pattern> — does not log anything
3. <Pattern>%msg|%mdc{idp.remote_addr}|%n</Pattern> — logs the IP address of the httpd server[1]
jetty.xml contains (uncommented):
<Call name="addCustomizer">
<Arg><New class="org.eclipse.jetty.server.ForwardedRequestCustomizer"/></Arg>
</Call>
Our Load Balancer is setting X-Forwarded-For, and it appears correctly in httpd logs; a small java app I wrote to print all the headers, prints the X-Forwarded-For and other X-Forwarded headers correctly, so Jetty is getting it. Wondering what might be missing with logback.xml or any other IdP configurations?
I searched the documentation, but the closest I got was idp.remote_addr (3rd pattern above) — hoping it is a matter of plugging in the right variable. Any ideas what that might be or where I could look for a list and/or docs?
Our IdP setup is: Client > Load Balancer > Apache (mod_proxy) > Jetty
Relevant versions: Jetty — 9.2.11, Apache httpd - 2.2.15, Java 1.8
Any guidance is much appreciated!
[1] https://wiki.shibboleth.net/confluence/display/IDP30/LoggingConfiguration <https://wiki.shibboleth.net/confluence/display/IDP30/LoggingConfiguration>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20150922/af0777c2/attachment.html>
More information about the users
mailing list