Li, 

Thanks for the reply. 

As indicated in your illustration,  in your case the remote IP address (IP of 
the client browser) is correctly displaying.

But in my case, for some reason even when my website is accessed remotely it 
always shows local IP Address (the website's IP address) and not the remote IP 
address. 

In other words 
%a %A %h  is translating *always* to 
127.0.0.1 
68.120.115.43 
127.0.0.1

Where 68.120.115.43  is the IP address of the website host and not the client 
(remote host). 

The website is hosted on a Tomcat 5.5 which is configured as a virtual host. I 
wonder if the virtual host setting might be the cause for not logging the 
actual remote IP address.

If I can't get Access Log Valve to log the remote IP address then I might have 
to try it with Log4J with Commons Logging to log the remote IP address I guess.

-Regards
Rashmi

----- Original Message ----
From: Li <[EMAIL PROTECTED]>
To: Tomcat Users List <users@tomcat.apache.org>
Sent: Monday, October 30, 2006 3:25:38 AM
Subject: Re: Is it possible to log IP Address of requestor with custom 
AccessLogValve pattern?


what you defined is correct ...  a simpler way is using default setting
<Valve
                  className="org.apache.catalina.valves.AccessLogValve"
                  directory="logs"
                  prefix="your-site-access-log-"
                  suffix=".log"
                  pattern="common"
                  resolveHosts="false"/>

the result should be
(if you are testing from same host)
127.0.0.1 - - [18/Oct/2006:18:54:48 +0800] "GET /site/ HTTP/1.1" 200 306
127.0.0.1 - - [18/Oct/2006:18:54:48 +0800] "GET /site/Welcome.do HTTP/1.1"
200 1775
(if your user testing from remote host)
202.110.6.23 - - [18/Oct/2006:19:03:44 +0800] "GET /site/Welcome.do
HTTP/1.1" 200 8893
...

On 10/30/06, Rashmi Rubdi <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> My site is hosted on Tomcat 5.5 and I'm trying to log the IP Address of
> search engine bots that crawl the site.
>
> After reading the following documentation here, which is written very
> nicely btw
> http://tomcat.apache.org/tomcat-5.5-doc/config/valve.html
>
> http://tomcat.apache.org/tomcat-5.5-doc/catalina/docs/api/org/apache/catalina/valves/AccessLogValve.html
>
> I configured the pattern attribute of AccessLogValve as follows:
>
> <Valve className="org.apache.catalina.valves.AccessLogValve"
> directory="logs"
> pattern="%a %A %h %H %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i""
> prefix="localhost_access_log." resolveHosts="false" suffix=".txt" />
>
> The following is a sample of what gets logged with the above configuration
> in server.xml .
>
> 127.0.0.1 68.120.115.43 127.0.0.1 HTTP/1.1 - [29/Oct/2006:23:50:13 -0800]
> "GET /web/_stylesheet/table.css HTTP/1.1" 304 - "
> http://www.website.com/c/a_page.jsp";; "Mozilla/5.0 (Windows; U; Windows NT
> 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7"
>
> The documentation says that %a is Remote IP Address, however 127.0.0.1 is
> being logged instead of the IP Address of the requestor.
>
> Is this correct?
>
> IMO %a should be the IP Address of the agent that's making the request - (
> i.e. the IP Address of a browser or a bot etc).
>
> Please let me know if there's a way to log IP Address of the agent that's
> making the request.
>
> Any help is appreciated.
>
> -Thank you
> Rashmi
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
When we invent time, we invent death.



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

Reply via email to