[news.sysadmin] Patch to C News for adequate logging for statistics

lmb@vicom.com (Larry Blair) (07/02/89)

Now that C News has been posted to c.s.u, it's time to post my very minor
modifications to create adequate log files for statistics generation.  Since
many admins may not have been following the original discussion, which
occurred before the c.s.u posting, I'll recap it.

The log file produced by C News is, IMHO, missing a few necessary items.
Henry Spencer has made it clear that he doesn't like using disk space for
logging, and that my patches probably will not be incorporated into the
released version.  Fortunately the patches required are so minor that it
will not be difficult to maintain the changes yourself.

An accompanying posting will contain a modified version of Erik Fair's
awk script to produce traffic statistics from my version of the C News
logs.

The patches are to two files.  The first patch, to history.c, adds the
following:

    The line for all accepted articles now contains the newsgroups to which
    the article were posted.

    Accepted control messages are indicated with a "c" instead of a "+",
    and the type of the control message appears on the line.

    The dummy history entry for cancel messages that arrive before the
    actual article are now indicated with a "f" instead of a "+".

This patch adds very little to the size of the log, but provides all the
information necessary to produce the site statistics.

The second patch, to procart.c, places the path by which a rejected
duplicate arrived in the log.  Since the duplicates usually arrive by
some long path, this patch will significantly increase the size of the
log if you receive a lot of duplicates.  On the other hand, without this
information it is nearly impossible for sites receiving a lot of dups to
tune their incoming feeds so as to reduce them.

*** relay/history.c.org	Sat Jun 17 23:14:20 1989
--- relay/history.c	Mon Jun 26 14:39:33 1989
***************
*** 184,191 ****
  
  	if (startlog) {
  		timestamp(stdout, &now);
! 		if (printf(" %s + %s", sendersite(nullify(art->h.h_path)),
! 		    msgid) == EOF)
  			fulldisk(art, "stdout");
  	} else
  		now = time(&now);
--- 184,199 ----
  
  	if (startlog) {
  		timestamp(stdout, &now);
! 		if(art->h.h_ngs == NULL) {
! 			if (printf(" %s f %s",
! 			    sendersite(nullify(art->h.h_path)), msgid) == EOF)
! 				fulldisk(art, "stdout");
! 		} else if (printf(" %s %c %s %s",
! 		    sendersite(nullify(art->h.h_path)),
! 		    (art->h.h_ctlcmd) ? 'c' : '+', msgid,
! 		    art->h.h_ngs) == EOF)
! 			fulldisk(art, "stdout");
! 		if ( art->h.h_ctlcmd && printf(" %s", art->h.h_ctlcmd) == EOF)
  			fulldisk(art, "stdout");
  	} else
  		now = time(&now);
*** relay/procart.c.org	Sat Jun 17 22:55:33 1989
--- relay/procart.c	Sat Jun 17 23:14:05 1989
***************
*** 298,304 ****
  		(void) printf("no Path: header\n");
  	} else if (alreadyseen(art->h.h_msgid)) {
  		prefuse(art);
! 		(void) printf("duplicate\n");
  	} else if (art->h.h_path != NULL && hopcount(art->h.h_path) > 0 &&
  	    !ngmatch(oursys()->sy_ngs, art->h.h_ngs)) {
  		extern boolean histreject;
--- 298,304 ----
  		(void) printf("no Path: header\n");
  	} else if (alreadyseen(art->h.h_msgid)) {
  		prefuse(art);
! 		(void) printf("duplicate - %s\n", art->h.h_path);
  	} else if (art->h.h_path != NULL && hopcount(art->h.h_path) > 0 &&
  	    !ngmatch(oursys()->sy_ngs, art->h.h_ngs)) {
  		extern boolean histreject;
-- 
Larry Blair   ames!vsi1!lmb   lmb@vicom.com