From: wessels <> Date: Sat, 7 Dec 1996 00:28:56 +0000 (+0000) Subject: adding X-Git-Tag: SQUID_3_0_PRE1~5319 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b88822c7469e4e5953ba86453a5fe45d828f960;p=thirdparty%2Fsquid.git adding --- diff --git a/contrib/user-agents.pl b/contrib/user-agents.pl new file mode 100755 index 0000000000..23c6718c43 --- /dev/null +++ b/contrib/user-agents.pl @@ -0,0 +1,47 @@ +#!/usr/bin/perl +# +# John@MCC.ac.uk +# John@Pharmweb.NET + +require "getopts.pl"; +&Getopts('FML:'); + +open (ACCESS, "/opt/Squid/logs/useragent.0"); + +while () { + ($host, $timestamp, $agent) = + /^(\S+) \[(.+)\] \"(.+)\"\s/; + if ($agent ne '-') { + if ($opt_M) { + $agent =~ tr/\// /; + $agent =~ tr/\(/ /; + } + if ($opt_F) { + next unless $seen{$agent}++; + } else { + @inline=split(/ /, $agent); + next unless $seen{$inline[0]}++; + } + } +} + +$total=0; +if (!$opt_L) {$opt_L=0} + +print "Summary of User-Agent Strings\n(greater than $opt_L percent)\n\n"; + +foreach $browser (keys(%seen)) { + $total=$total+$seen{$browser}; +} + +foreach $browser (sort keys(%seen)) { + $percent=$seen{$browser}/$total*100; + if ($percent >= $opt_L) { write; } +} + +print "\n\nTotal entries in log = $total\n"; + +format STDOUT = +@>>>>>>> :@##.####% : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +$seen{$browser}, $percent, $browser +.