pst@anise.acc.com (Paul Traina) (10/04/89)
Here is something I tossed together that works rather well at this site.
I augment it with NNTP statistics, which generally solves some of the
nagging terseness present in the C news log files. If in places it seems
a little verbose, that is due to the fact that I wanted it to know how
to parse 'foo.bar,baz.zork' correctly.
Enjoy or destroy.
# awk file to summarize news activity
# pst@anise.acc.com 10aug89
BEGIN {
gotjunk = 0
gotsub = 0
gotun = 0
}
{ name[$4] = $4 }
$5 == "+" {
rcvd[$4]++
for (i = 7; i <= NF; i++) {
name[$i] = $i
sent[$i]++
}
}
$5 == "j" {
gotjunk = 1
junk[$4]++
ng = substr(substr($11, 1, length($11) - 1), 2, length($11) - 2)
split(ng, ngs, ",")
for (m in ngs)
badgroup[ngs[m]]++
}
$5 == "-" {
if ($7 == "duplicate") {
dupd[$4]++
next
}
if ($7 == "unapproved") {
gotun = 1
reject[$4]++
ng = substr(substr($12, 1, length($12) - 1), 2, length($12) - 2)
split(ng, ngs, ",")
for (m in ngs)
unapp[ngs[m]]++
next
}
if ($8 == "subscribed") {
gotsub = 1
reject[$4]++
ng = substr(substr($11, 1, length($11) - 1), 2, length($11) - 2)
split(ng, ngs, ",")
for (m in ngs)
nosub[ngs[m]]++
next
}
if ($7 == "all" && $8 == "groups") {
gotex = 1;
excl[$4]++
ng = substr(substr($9, 1, length($9) - 1), 2, length($9) - 2)
split(ng, ngs, ",")
for (m in ngs)
excluded[ngs[m]]++
next
}
# some other reason? print the message
print
}
END {
print
printf "%-14s%6s%6s%6s%6s%6s\n", "System", "Rcvd", "Dup", "Junk", "Sent", "Excl"
for (i in name)
printf "%-14s%6d%6d%6d%6d%6d\n", i, rcvd[i], dupd[i], junk[i], sent[i], excl[i]
if (gotjunk) {
print
print "Bad newsgroups received:"
for (i in badgroup)
printf "%-26s%6d\n", i, badgroup[i]
}
if (gotsub) {
print
print "Newsgroups with no subscription:"
for (i in nosub)
printf "%-26s%6d\n", i, nosub[i]
}
if (gotun) {
print
print "Unapproved articles:"
for (i in unapp)
printf "%-26s%6d\n", i, unapp[i]
}
if (gotex) {
print
print "Excluded newsgroups:"
for (i in excluded)
printf "%-26s%6d\n", i, excluded[i]
}
}
--
Insanity is the exception in individuals. In groups, parties, people,
and times, it is the rule.
-- Nietzche