earle@smeagol.UUCP (01/29/87)
Erik Fair submitted a toolbox of UUCP and Netnews tools to mod.sources in October (article 511@mirror.UUCP). One of these tools was the `report_awk' script, which processes the news `log' file and emits statistics, usually for use in submitting weekly USENET reports to newsgroups like yourlocalarea.news, or to.yourneighbor. These are usually done with a log file that holds the previous week's data. No doubt most of you have seen postings called `Weekly USENET report for blobvax'; this is the script that produces them. Here is a context diff file which adds support for some overlooked 2.11 logfile features, adds support for another result of an attempted Control invocation, and fixes a 2.10.2 dependency that caused a bug under 2.11, when emitting the `Bad Newsgroups Received' section (has been made compatible with either 2.10.2 or 2.11 format). [ Unrelated note: there seems to be a bug/feature in 2.11, which causes lines to be logged in the log file that are more than 2 line lengths (i.e., > 160 characters long) to get a linebreak that separates the after-160th characters onto a separate line. This causes this script to emit these orphaned lines in the catchall { print } statement that prints out anything it didn't recognize, because it was "probably an error message". Anyone know if this is a bug that should be fixed, or merely an inconvenience for this script? ] Gripes, moans, kudos, whathaveyou to me at addresses in .signature below. ---------------- Cut Here 8< ------------------ Cut Here 8< ---------------- *** report_awk.orig Wed Jan 28 23:38:01 1987 --- report_awk Wed Jan 28 23:59:10 1987 *************** *** 2,8 **** # AWK script which eats netnews log files and produces a summary of USENET # traffic and errors over the period of time that the log was collected. # ! # August 31, 1986 # # Erik E. Fair <dual!fair> # Original Author, May 22, 1984 --- 2,8 ---- # AWK script which eats netnews log files and produces a summary of USENET # traffic and errors over the period of time that the log was collected. # ! # January 28, 1987 # # Erik E. Fair <dual!fair> # Original Author, May 22, 1984 *************** *** 37,42 **** --- 37,57 ---- # Fix up the counting of gatewayed material, add counting of "linecount" # problems. Additional cleanup to make things faster. # + # Greg Earle <smeagol!earle> + # Add support for added features of 2.11 that didn't make it into the + # released version. These include: + # - Field 5 = "Expired" when a control cancel invocation tries to + # cancel an already expired article. Added new variable to count + # these, and are displayed in `Control Invocations' area. + # - Field 5 = "Aliased", + # Field 5 = "queued" - ignored (added to `Skip some things we won't + # bother with' area) + # - Field 7 = "Unknown" when a bad newsgroup. Netnews version 2.10.2 had + # newsgroup name in single quotes, thus bad newsgroup names were + # being stored after stripping first and last characters. 2.11 does not + # use quotes around newsgroup name, so added a check to see if single + # quoted or not. If not quoted, assumes 2.11. If quoted assumes 2.10.2. + # Handles both cases. I don't recall if 2.10.3 was "old" style or "new". BEGIN{ # # this is the prefix that your site uses in hostnames to identify your *************** *** 103,108 **** --- 118,124 ---- lcount = 0; canfail = 0; candup = 0; + canexp = 0; insfail = 0; old = 0; } *************** *** 113,122 **** --- 129,141 ---- $5 == "from" { next } $5 == "make" { next } $5 == "Cancelling" { next } + $5 == "Aliased" { next } + $5 == "queued" { next } # # Or that we just count # $5 == "Inbound" { garbled++; next } + $5 == "Expired" { canexp++; next } $6 == "cancel" { canfail++; next } $6 == "Cancelled" { candup++; next } $6 == "install" { insfail++; next } *************** *** 196,203 **** --- 215,229 ---- $6 == "valid" { junked[sys]++; next } $6 == "too" { junked[sys]++; old++; next } $5 == "Unknown" { + # + # Next line is OK if 2.11. If 2.10.2 (& 2.10.3 ?) then + # we have to strip off the single quotes around the newsgroup name. + # + ng = $7; + if (index(ng, "'") != 0) { x = length($7) - 2; ng = substr($7, 2, x); + } badng[ng]++; badgrp++; next; *************** *** 354,359 **** --- 380,386 ---- printf("%-12s %6d", i, ctlcnt[i]); if (canfail) printf(", %d failed", canfail); if (candup) printf(", %d duplicate", candup); + if (canexp) printf(", %d already expired", canexp); printf("\n"); } else { printf("%-12s %6d\n", i, ctlcnt[i]); -- Greg Earle UUCP: sdcrdcf!smeagol!earle; attmail!earle JPL ARPA: elroy!smeagol!earle@csvax.caltech.edu AT&T: +1 818 354 4034 earle@jplpub1.jpl.nasa.gov (For the daring) Should I start with the time I SWITCHED personalities with a BEATNIK hair stylist or my failure to refer five TEENAGERS to a good OCULIST? -- Greg Earle UUCP: sdcrdcf!smeagol!earle; attmail!earle JPL ARPA: elroy!smeagol!earle@csvax.caltech.edu AT&T: +1 818 354 4034 earle@jplpub1.jpl.nasa.gov (For the daring) Should I start with the time I SWITCHED personalities with a BEATNIK hair stylist or my failure to refer five TEENAGERS to a good OCULIST?