Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!utegc!utcsri!utcs!lsuc!dave From: dave@lsuc.UUCP Newsgroups: tor.news Subject: source to "scanlog" Message-ID: <1443@lsuc.UUCP> Date: Thu, 11-Dec-86 08:15:48 EST Article-I.D.: lsuc.1443 Posted: Thu Dec 11 08:15:48 1986 Date-Received: Sun, 14-Dec-86 10:11:48 EST References: <264@spectrix.UUCP> Reply-To: dave@lsuc.UUCP (David Sherman) Distribution: tor Organization: Law Society of Upper Canada, Toronto Lines: 139 Summary: posted here Since people keep asking me for it, I might as well post it. NOTES: 1. This was written as a quick hack by {lsuc,sq}!msb some time back. It doesn't pretend to be good code. 2. It's set up for v7-style UUCP SYSLOG files. For other flavours of UNIX, some mods will be needed because more information is kept in SYSLOG. Perhaps some of the people who have already received and modified it would care to post diffs for 4.2BSD or whatever. 3. It reads from SYSLOG.recent. We have an "earlymorn" script which runs every night; among other things, it does a mv SYSLOG SYSLOG.recent. scanlog runs later. You have to be careful with these things, and not to cp-then-truncate an existing file, or you can lose data from a currently-running uucico. 4. There are two files, scanlog and sca. We keep both in /usr/lib/news. 5. Our earlymorn entry to post the results looks like this: /usr/lib/news/scanlog 2>&1 > /tmp/scanlog.out date >> /usr/adm/newsxfr sed '/local/q' /tmp/scanlog.out >> /usr/adm/newsxfr mail -s "Nightly news report" dave keith < /tmp/scanlog.out (echo -n "24-hour (approx.) period ended: ";date;cat /tmp/scanlog.out) | /usr/lib/news/inews -t "lsuc UUCP & news report" \ -n tor.news -f dave@lsuc.UUCP Note that you'll need to change the details here to suit your site. 6. Anyone who wants to revise this into a better tool for summarizing the information most relevant to Toronto news distribution, feel free to. David Sherman ---------------------- /usr/lib/news/scanlog -------------------- stdin=${1-/usr/lib/news/log} /usr/lib/news/sca $stdin ${2-/usr/spool/uucp/SYSLOG.recent} awk 'BEGIN {errors=0; badlinecounts=0; received=0; posted=0; dups=0; garbled=0; notinsys=0; notinstall=0; linkfailed=0; cancelled=0; cfail=0; csuccess=0; cgroups=0; ctlmsgs=0; old=0} /Bad option/{next} /Duplicate/{dups++; next} /Ctl Msg/ {ctlmsgs++; next} /Article too old/ {old++; next} /posted/ {posted++; next} # Sent to corresponds to posted, except for local group postings. /sent to/ {next} /subj.*cmsg cancel/{cancelled++; next} /subj.*cancel/{cancelled++; next} /Can.t cancel/{cfail++; next} /Cancelling/{csuccess++; next} /cancel article/{cgroups++; next} /from/ {next} /received/ {received++; next} /linecount/{badlinecounts++; next} /in active, but not sys/{notinsys++;next} /Link into.*failed/ {linkfailed++;next} /Cannot install article/ {notinstall++;next} /Inbound news is garbled/ {garbled++;next} /^ / {next} {if (length==0) next; if (errors++ == 0) { print "Miscellaneous errors:"; } print; next} /cancel/ {next} END {print " SUMMARY OF MESSAGES" if (posted) print posted,"articles posted." if (ctlmsgs) print ctlmsgs,"control messages received." if (received) print received,"articles received." if (badlinecounts) print badlinecounts,"articles/duplicates had bad line counts." if (cancelled) { print cancelled " articles cancelled, " cfail " unsuccessfully," print " " csuccess " successfully in " cgroups " groups." } if (old) print old " old articles moved to junk." if (dups) print dups,"duplicate articles rejected." if (notinsys) print notinsys,"articles in groups not in sys file." if (notinstall) print notinstall,"articles could not be installed." if (linkfailed) print linkfailed,"links failed." if (garbled) print garbled,"inbound batches were garbled." } ' $stdin ---------------------- /usr/lib/news/sca -------------------- cat <length(n[sys])) n[sys] = $1 t[sys] += $2; r[sys] += $3; s[sys] += $4 a[sys] += $5; d[sys] += $6; q[sys] += $7; local += $8 } END { for (sys in t) if (sys != "Local") printf "%12d:%-13s%12d%12d%12d%9d%10d \n", t[sys], \ n[sys], r[sys], s[sys], a[sys], d[sys], q[sys] if (local>0) printf "%12d:%49d originated locally\n", 0, local } ' | sort -r | sed 's/.*:// s/ \([^ ]*[0-9]\)\([0-9][0-9][0-9][^0-9]\)/\1,\2/g s/ \([^ ]*[0-9]\)\([0-9][0-9][0-9][^0-9]\)/\1,\2/g /Total/ !s/ 0 / /g /locally/s/ orig/0 orig/ s/ *$// 1s/$/\ /' -- { ihnp4!utzoo seismo!mnetor utai watmath decvax!utcsri } !lsuc!dave