Perlfect Solutions
 

[Perlfect-search] logfile entries with no remote host

Daniel Naber daniel.naber@t-online.de
Sun, 3 Mar 2002 01:36:29 +0100
--------------Boundary-00=_TCGDI5NH9V7Z3IDESS7T
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

On Sunday 03 March 2002 00:50, chris holmes wrote:

> I am using the logging feature to record queries to a logfile, some of
> the queries don't show a remote host ip or name, is this because it
> can't do a dns resolve on the ip?

Exactly. Please try the attached patch. It should display the IP, but onl=
y=20
if the name is not known. Let me know if it works, I will then add it to=20
version 3.30. If you don't know about the "patch" command, just remove th=
e=20
lines with the "-" and replace them with the "+" lines in an editor in=20
search.pl.

Regards
 Daniel

--=20
http://www.danielnaber.de

--------------Boundary-00=_TCGDI5NH9V7Z3IDESS7T
Content-Type: text/x-diff;
  charset="us-ascii";
  name="log.diff"
Content-Disposition: attachment; filename="log.diff"
Content-Transfer-Encoding: 7bit

Index: search.pl
===================================================================
RCS file: /home/perlfect.com-dev/search/search.pl,v
retrieving revision 1.70
diff -u -r1.70 search.pl
--- search.pl   2002/03/02 16:58:49     1.70
+++ search.pl   2002/03/03 00:33:32
@@ -497,7 +497,8 @@
 
   my $elapsed_time = sprintf("%.2f", Time::HiRes::tv_interval($start_time)) if( $start_time );
   my @line = ();
-  push(@line, $ENV{'REMOTE_HOST'} || '-',
+  my $addr = $ENV{'REMOTE_HOST'} || $ENV{'REMOTE_ADDR'};
+  push(@line, $addr || '-',
               get_iso_date(), 
               $query->param('q') || '-',
               scalar(keys %answer),

--------------Boundary-00=_TCGDI5NH9V7Z3IDESS7T--