Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Logging accesses to my web app

 
Hui Ge
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sharad Agarwal
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic