| Author |
Logging accesses to my web app
|
Hui Ge
Greenhorn
Joined: Mar 11, 2005
Posts: 25
|
|
Hi, Suppose i want to log access to my web app. Is there anyway i can get the ip of the requestor's computer so that i can log this information? I tried to look at the http header specs. There is no such information. Just like to know if it is impossible to track such accesses. (Deeper thoughts: even if i can get the ip it would most probably be a proxy ip which is not very useful. But then to satisfy my curiousity...) Thanks in advance.
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
request.getRemoteAddr will get you the user's IP. It may be the address of a proxy. Install the LiveHttpHeaders plugin to FireFox and you will be able to see exactly what information is sent to and from the browser.
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Sharad Agarwal
Ranch Hand
Joined: Sep 11, 2002
Posts: 167
|
|
|
Ben - I do have the LiveHTTPHeaders plugin, but it does not show the IP of either the server or the client. I am assuming that information is available in lower layers of the network stack?
|
Alco-Haul: We move spirits.
Demented Deliberations of a Dilettante
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Yes, I guess it is lower in the stack. Here is a sample that I grabbed with the tcpflow packet sniffer: Either way, request.getRemoteAddr will get the user's IP. Again, it won't be able to tell you if it's a proxy or not (to the best of my knowledge).
|
 |
Sharad Agarwal
Ranch Hand
Joined: Sep 11, 2002
Posts: 167
|
|
Originally posted by Ben Souther: ... tcpflow packet sniffer:
This is a little off-topic. This sounds like a cool tool. Does it work on Windows XP? My Google search leads to a page that seems to suggest that it is meant for Macs: http://www.phpmac.com/articles.php?view=139 Is this the right URL? Wanted to check before downloading and running an executable.
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
I'm running it on a Linux box. Not sure if there is a windows version. This is the site where I found it: http://www.owlriver.com/tips/tcpflow-tutorial/ And, yes, a packet sniffer is a great debugging tool when working on webapps. I know there is a windows version of Ethereal which is another popular one. [ June 22, 2005: Message edited by: Ben Souther ]
|
 |
 |
|
|
subject: Logging accesses to my web app
|
|
|