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

Hi all, I have a setup with four servers. when a user tries to connect, he gets connected to any of the four machines on a round robin basis. My doubt is will i be able to log the IP address of the machine to which a user gets connected to through a UserAgent request thanks for all your help

Replies are listed 'Best First'.
Re: Logging IP address of the machine
by JayBonci (Curate) on Feb 09, 2002 at 01:56 UTC
    (assuming that you are using CGI)

    You can check the IP of the computer connecting to you through: $ENV{REMOTE_ADDR}

    The machine that the script is running on is: $ENV{SERVER_NAME}



    The User agent: $ENV{HTTP_USER_AGENT} is only good for the browser name and version. Hope this helps. If you aren't referring to a CGI/Web app, please mention what you are using.

       --jb