I've written a small script that outputs statistical information about the
proxy/cache flow. These numbers are not (or less detailed) reported by the
other analysis scripts flowing around.
Requirements:
- GNU awk
- an access.log file in Squid's native format
I'd like to extend this script to report as much useful information as possible,
so please let me know any useful additions and improvements I could make.
Enjoy,
Richard.
BEGIN {
tr = 0
tb = 0
tt = 0
badlines = 0
deniedfl = 0
}
{
if ((NF != 7) || (split($4, codes, /\//) != 3)) { badlines++; next; }
throughput = ($2 != 0) ? ($5 / $2) : 0
lr[codes[1]] += 1
lb[codes[1]] += $5
lt[codes[1]] += throughput
sr[codes[2]] += 1
sb[codes[2]] += $5
st[codes[2]] += throughput
hr[codes[3]] += 1
hb[codes[3]] += $5
ht[codes[3]] += throughput
tr += 1
tb += $5
tt += throughput
if (index(codes[1], "DENIED")) { denied[$3]++; deniedfl = 1; }
}
END {
print "Parsed lines: " tr
print "Bad lines : " badlines
if (deniedfl) {
print ""
print "Denied clients reqs"
print "------------------------- ------"
for (ipnr in denied) printf "%-25s %6d\n", ipnr, denied[ipnr] | "sort"
close("sort")
}
print ""
print "Local code reqs %all MB %all kB/r kB/s"
print "------------------------- ------------- ------------- -------------"
for (c in lr) print_code(c, lr[c], lb[c], lt[c])
close("sort")
print ""
print "Status code reqs %all MB %all kB/r kB/s"
print "------------------------- ------------- ------------- -------------"
for (c in sr) print_code(c, sr[c], sb[c], st[c])
close("sort")
print ""
print "Hierarchie code reqs %all MB %all kB/r kB/s"
print "------------------------- ------------- ------------- -------------"
for (c in hr) print_code(c, hr[c], hb[c], ht[c])
close("sort")
print ""
print_code("Total", tr, tb, tt)
close("sort")
}
function print_code(c, r, b, t) {
printf "%-25s %6d %5.1f%% %6.1f %5.1f%% %6.1f %6.1f\n", \
c, r, r/tr*100, b/1048576, b/tb*100, b/1024/r, t/1.024/r \
| "sort"
}
Received on Sun Jul 28 1996 - 10:15:58 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:32:43 MST