I just setup the squilog summary scripts but was annoyed by the hostnames
which looked like:
edu.yale.cs.systemsz.pe
edu.yale.cs.home.kuszma
edu.yale.cs.systemsz.te
in other words, the useless info (only hosts from yale.edu can connect)
is well in sight, but the actual hostname is lost. So I just tweaked the
squid-logs.pl to remove the localdomain suffix. The patch is appended.
Stefan
PS: of course, the localdomain could be automatically extracted from the
/etc/resolv.conf file, but I didn't bother.
*** /homes/systems/monnier/softs/perl5/squidlogs/squid-logs.pl Fri Feb 21 20:06:05 1997
--- /usr/local/adm/cron/squid/squid-logs.pl Tue Mar 25 19:20:06 1997
***************
*** 12,17 ****
--- 12,18 ----
%Month = ("Jan", 0, "Feb", 1, "Mar", 2, "Apr", 3, "May", 4, "Jun", 5,
"Jul", 6, "Aug", 7, "Sep", 8, "Oct", 9, "Nov", 10, "Dec", 11);
+ $localdomain = "yale.edu";
sub parse_common_log {
local($_) = @_;
***************
*** 120,126 ****
($a1,$a2,$a3,$a4) = split('\.', $dotaddr);
($fqdn, @F) = gethostbyaddr(pack('C4',$a1,$a2,$a3,$a4),2);
$fqdn =~ tr/A-Z/a-z/;
! $FQDN{$dotaddr} = $fqdn unless ($fqdn eq '');
return $FQDN{$dotaddr};
}
--- 121,132 ----
($a1,$a2,$a3,$a4) = split('\.', $dotaddr);
($fqdn, @F) = gethostbyaddr(pack('C4',$a1,$a2,$a3,$a4),2);
$fqdn =~ tr/A-Z/a-z/;
! if ($fqdn =~ /$localdomain$/) { # if it's a local machine
! $fqdn =~ s/$localdomain$//;
! } else {
! $fqdn = "${fqdn}.";
! }
! $FQDN{$dotaddr} = $fqdn unless ($fqdn eq '.');
return $FQDN{$dotaddr};
}
Received on Tue Mar 25 1997 - 16:34:45 MST
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:34:46 MST