Subversion Repositories cms

Compare Revisions

No changes between revisions

Ignore whitespace Rev 9 → Rev 10

/trunk/test/SQUID/squid_tracelog
0,0 → 1,45
#!/usr/bin/perl
# ---------------------------------------------------------------------- #
# Copyright: (C) 2002 Leader.IT S.r.l. <http://leader.it>
# Author: Guido Brugnara <gdo@leader.it>
#
# $Revision$ info@leader.it
# ---------------------------------------------------------------------- #
#
# Traccia il file di LOG di squid separando le righe per utente connesso
#
#
my $FILELOG='/var/squid/logs/access.log';
$|=1;
open SQUIDLOG, "<$FILELOG" || die "Error on open file $FILELOG";
seek(SQUIDLOG, 0, 2);
my $Old_rfc931;
for(;;) {
for ($curpos = tell(SQUIDLOG); $_ = <SQUIDLOG>; $curpos = tell(SQUIDLOG)) {
my($time, $duration, $client_address, $result_codes, $bytes, $request_method, $URL, $rfc931, $hierarchy_code, $type)
= split /\s+/, $_;
$time =~ m/(\d+)\.(\d+)/;
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($1);
my $time = sprintf("%04d/%02d/%02d %02d:%02d:%02d.%03d", 1900+$year, $mon+1, $mday, $hour, $min, $sec, $2);
 
if($rfc931 ne $Old_rfc931){
if($Old_rfc931){
close LOG;
}
open LOG, ">>/var/log/squid_redirector/$rfc931";
select LOG;
$|=1;
$Old_rfc931=$rfc931;
}
# print STDERR "User $rfc931: $time $bytes $result_codes $hierarchy_code $URL\n";
print "$time $bytes $result_codes $hierarchy_code $URL\n";
}
# sleep for a while
sleep 1;
seek(SQUIDLOG, $curpos, 0);
}
if($Old_rfc931){
close LOG;
}
 
close SQUIDLOG;
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:executable
+*
\ No newline at end of property
Added: svn:keywords
+Author Date Id Revision
\ No newline at end of property
/trunk/test/SQUID/README
1,3 → 1,7
squid_redirect:
 
Esempio di script per Squid Redirector scritto in Perl
 
squid_tracelog:
 
Esempio di script per Squid per tracciare il LOG in tempo reale