--------------------- PatchSet 11190 Date: 2007/01/24 08:03:52 Author: adrian Branch: HEAD Tag: (none) Log: Modify the script slightly to allow the user to override the aggregation term. BY default its "username" but there are other options (eg try "clientip"). Members: scripts/PerUser.pl:1.1->1.2 Index: squid/scripts/PerUser.pl =================================================================== RCS file: /cvsroot/squid/squid/scripts/PerUser.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- squid/scripts/PerUser.pl 24 Jan 2007 07:01:36 -0000 1.1 +++ squid/scripts/PerUser.pl 24 Jan 2007 08:03:52 -0000 1.2 @@ -7,19 +7,26 @@ # statistics. # # Adrian Chadd -# $Id: PerUser.pl,v 1.1 2007/01/24 07:01:36 adrian Exp $ +# $Id: PerUser.pl,v 1.2 2007/01/24 08:03:52 adrian Exp $ use Squid::ParseLog; my %u; +my $wh; + +$wh = "username"; +if (scalar @ARGV >= 1) { + $wh = $ARGV[0]; + shift @ARGV; +} while (<>) { chomp; my $l = Squid::ParseLog::parse($_); - if (! defined $u{$l->{"username"}}) { - $u{$l->{"username"}}->{"traffic"} = 0; + if (! defined $u{$l->{$wh}}) { + $u{$l->{$wh}}->{"traffic"} = 0; } - $u{$l->{"username"}}->{"traffic"} += $l->{"size"}; + $u{$l->{$wh}}->{"traffic"} += $l->{"size"}; } foreach (keys %u) {