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


I'm experimenting with a couple of HTTPd's (names removed to protect the guilty innocent) that are fairly light, but don't resolve the connecting IP addresses (provide the HOST name) in the logs. I've contacted the devs of both of them asking why not, or if when. But the answers were basically, too heavy && too slow. Which, to me, seemed more an excuse. As the facility could have simply been implemented as an option. But they're not my HTTPd's.

So, I did some experimentation, and was able to get my web pages to return the HOST names of the connecting IP's in the following manner (all my pages are CGI/Perl):

... use strict; use feature qw(say); use Socket; ... my $remote_ip = $ENV{REMOTE_ADDR}; # note: don't try this at home kids, unless you have a fast local DNS +(server) my $remote_host = gethostbyaddr(inet_aton($remote_ip), AF_INET);
Which, as you might imagine; allows me to return the HOST name contained inside $remote_host.

So, Perl will give me what the HTTPD won't -- I love Perl! So how might I best achieve the same simultaneously within my HTTPd logs? I'm guessing pipe is probably involved here. But I'd really rather run this whole thing past the many brilliant minds, and monks here. In hopes of getting the best solution. :-)


Evil is good, for without it, Good would have no value
λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH