kcantrel@digi.lonestar.org (Keith Cantrell) (01/29/91)
We are in the process of moving over to Cnews from Bnews-2.11.18 and noticed one draw back, the awk script original written by Erik E. Fair, and then later heavily modified by many others, does not work with the Cnews log files. This awk script generates a nice little summary of all the News activity, including who we received news from, how much of it we used, and how much we rejected, and some other interesting statistics. I am wondering if anybody has ported this script over to the Cnews format of log files, or if anybody has an equivalent one. Thanks, Keith Cantrell ----------------------------------------------------------------------- Keith Cantrell Phones: hm: 214-492-1088 Apollo Computer wk: 214-519-2399 @ DSC A Subsidiary of Hewlett-Packard USMAIL: EMAIL: 2100 Sonata Ln kcantrel@digi.lonestar.org Carrollton TX 75007 or ...!uunet!digi!kcantrel -----------------------------------------------------------------------
palkovic@linac.fnal.gov (John A. Palkovic) (02/01/91)
In article <1649@digi.lonestar.org> kcantrel@digi.lonestar.org (Keith Cantrell) writes: >We are in the process of moving over to Cnews from Bnews-2.11.18 and >noticed one draw back, the awk script original written by Erik E. >Fair, and then later heavily modified by many others, does not work >with the Cnews log files. >[...] >I am wondering if anybody has ported this script over to the Cnews format >of log files, or if anybody has an equivalent one. I asked myself the same question once and wrote this. Apparently 5 or more people have requested it so I'm posting. It's a lot easier with C news log files, since they have less cruft in them. The "control" and "failed" items only have meaning if you have applied Dave Alden's patch to relaynews. Of course this voids your warranty. :-) #!/bin/sh # This is a shell archive (shar 3.46) # made 01/31/1991 19:11 UTC by palkovic@linac # # existing files will NOT be overwritten unless -c is specified # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 1547 -rwxr-xr-x posters_awk # # ============= posters_awk ============== if test -f 'posters_awk' -a X"$1" != X"-c"; then echo 'x - skipping posters_awk (File already exists)' else echo 'x - extracting posters_awk (Text)' sed 's/^X//' << 'SHAR_EOF' > 'posters_awk' && #!/bin/sh # # Shell/awk script for chewing up Cnews log files and spitting out # summary news stats. Reads from standard input or give it a news log # file as an argument. Bug fixes and enhancements welcome. # # If you don't run with the relaynews daemon patch change the 'i = 8' # in the for() just below to 'i = 7'. You might want to rip out the # "control" and "failed" stuff, too. # # John A. Palkovic 1/31/91 # # Keith Cantrell (kcantrel@digi.lonestar.org) added the ability to # print the summary of files sent out. 1/30/90 # awk ' { X if ($5 == "+") { X freq[$4]++; X for ( i = 8; i <= NF; i++) X sent[$(i)]++; X } X if ($5 == "-") reject[$4]++ X if ($5 == "c") control[$4]++ X if ($5 == "f") failed[$4]++ }END{ X printf " posts\t rjct\t ctrl\t fail\thost\n" X printf " -----\t-----\t-----\t-----\t--------------------------\n" X for(host in freq) { X printf " %5d\t%5d\t%5d\t%5d\t%s\n", \ X freq[host], reject[host], control[host], failed[host], host X totalpost += freq[host] X totalreject += reject[host] X totalcontrol += control[host] X totalfailed += failed[host] X } X printf " -----\t-----\t-----\t-----\t--------------------------\n" X printf " %5d\t%5d\t%5d\t%5d\ttotals\n", \ X totalpost,totalreject,totalcontrol,totalfailed X printf "\n\nNumber of articles sent:\n"; X for(host in sent) { X printf "%12s:%7d\n", host, sent[host] X totalsent += sent[host]; X } X printf "--------------------\n"; X printf "%12s %7d\n", "total", totalsent; }' $1 X SHAR_EOF chmod 0755 posters_awk || echo 'restore of posters_awk failed' Wc_c="`wc -c < 'posters_awk'`" test 1547 -eq "$Wc_c" || echo 'posters_awk: original size 1547, current size' "$Wc_c" fi exit 0 -- palkovic@linac.fnal.gov || {royko,simon,tellab5}!linac!palkovic