Configuring logback.xml to log X-Forwarded-For/Client IP in audit logs in IdP v3

Brent Putman putmanb at georgetown.edu
Tue Sep 22 16:06:53 EDT 2015



On 9/22/15 3:55 PM, Khawer Masood wrote:
> 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


I wasn't aware of that component in Logback.  Looks nice.  In order for
it to work, you have to add the MDCInsertingServletFilter to your
web.xml.  Are you saying you've done that and it's still not working? 
If so, I'd bet you just have an issue with the filter mapping or
something like that.  Not aware of anything IdP-specific that would
prevent it from working.


>
> 3. <Pattern>%msg|%*mdc*{idp.remote_addr}|%n</Pattern> — logs the IP
> address of the httpd server[1] 
>


Yeah, in a proxy environment, that's not going to work - unless the
container has support for overriding and setting the request's remote
address based on the X-Forwarded-For, or something like that.  Don't
know if Jetty does.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20150922/dfc38fc6/attachment-0001.html>


More information about the users mailing list