tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maurice Yarrow <yar...@best.com>
Subject Re: obtain X-Forwarded-for: client-IP-address in access logs
Date Fri, 03 Nov 2006 22:07:44 GMT
Hello, again, Tomcat community:

I found the answer to my own question below:
Use:

     pattern="%{X-Forwarded-for}i %l %u %t %r %s %b"

in the access log valve config.

Only thing: I would like to surround the %r with "%r", as
is done in the "common" setup.
What byzantine combination of  single quote, double quote,
backslashes is required for this to be acceptable to the
serverl.xml XML readin ?  (I tried a whole bunch of different
combinations but all error'ed out on startup.)

Maurice




Maurice Yarrow wrote:

> Hello Tomcat community
>
> I have tomcat (5.0.28) running behind pound (2.1.3) 
> reverse-proxy-load-balancer.
>
> This is a very effective setup, as I have pound also fronting apache 
> and mongrel-rails
> clusters.
>
> Question:
> Pound adds the following to its request to backend servers:
>     X-Forwarded-for: client-IP-address
>
> I would like to be able to obtain this client-IP address in the tomcat 
> access logs.
> I tried all available formats (%a,  %A,  %b,  %B,  etc.,etc.) for the 
> logger pattern,
> but of course, none produced the client IP address placed in the 
> request by
> Pound.
> I could, of course, grep through the Pound log output which, by 
> default, winds
> up on /var/log/messages, but would rather just be able to see this in the
> tomcat access log.
>
> How could I, say, derive my own logger class and capture this header 
> info that
> pound places in the request to backend server ??
>
> Is there a simpler way ?   Am I unaware of a direct way to do this ?
>
> Maurice Yarrow
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message