Jeganath KS has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks, I need to develop a Perl script which should run on server machine to find out the requested client's IP address and the type of request(Actually I need to track what are all the web pages that are being requested by particular client machine). Is it possible with Perl? If yes, how do I get started?

Replies are listed 'Best First'.
Re: How to get client machine IP address
by JavaFan (Canon) on Aug 24, 2010 at 10:27 UTC
    The simplest way would be to just run an analyzer on the web server logs. There are many (free) analyzers out there. Just do a search.

    Bear in mind though that all you'll be getting is whatever IP address the last proxy in the request chain was using at the time. IP addresses do not identify machines. IP addresses are assigned to interfaces. One machine may have multiple interfaces (even the simplest setup will typically have at least two interfaces: 127.0.0.1 for the loopback interface is also an IP address). One interface may have multiple IP addresses. And IP addresses may move.

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: How to get client machine IP address
by doug (Pilgrim) on Aug 24, 2010 at 17:01 UTC

    What is the server serving? Someone else assumed it was a web server, but I don't see that in your request. This does matter. If you can hack up the source for the server, then the easiest command is  getpeername(). If not, you'll have to go through some secondary thing like scanning log files or running  netstat.

    - doug