Article View: news.software.nntp
Article #12036Patch for innxmit logging
From: Steve Waltner
Date: Fri, 01 Nov 1996 00:00
Date: Fri, 01 Nov 1996 00:00
178 lines
7642 bytes
7642 bytes
Here is a patch I wrote that "fixes" logging in innxmit on INN
1.4unoff4 when using the -P option. In my case, the -P option to
nntpsend/innxmit is used to select which feed to connect to out of
multiple outgoing feeds through our firewall. The problem was that all
logging from innxmit was done with the remote host name, our firewall
host, which is the same for all these cases. This patch changes innxmit to
log information based on the feed name (actually the batch file name minus
.nntp) so that the summary information in news.daily makes sense.
*** innxmit.c.orig Wed Feb 28 08:19:06 1996
--- innxmit.c Fri Oct 1 08:15:50 1996
***************
*** 109,114 ****
--- 109,115 ----
STATIC char *BATCHname;
STATIC char *BATCHtemp;
STATIC char *REMhost;
+ STATIC char *SITEname;
STATIC double STATbegin;
STATIC double STATend;
STATIC FILE *BATCHfp;
***************
*** 462,478 ****
if (STATprint) {
(void)printf(STAT1,
! REMhost, STAToffered, STATaccepted, STATrefused, STATrejected);
(void)printf("\n");
! (void)printf(STAT2, REMhost, usertime, systime, STATend - STATbegin);
(void)printf("\n");
}
syslog(L_NOTICE, STAT1,
! REMhost, STAToffered, STATaccepted, STATrefused, STATrejected);
! syslog(L_NOTICE, STAT2, REMhost, usertime, systime, STATend - STATbegin);
if (retries)
! syslog(L_NOTICE, "%s %lu Streaming retries", REMhost, retries);
if (BATCHfp != NULL && unlink(BATCHtemp) < 0 && errno != ENOENT)
(void)fprintf(stderr, "Can't remove \"%s\", %s\n",
--- 463,479 ----
if (STATprint) {
(void)printf(STAT1,
! SITEname, STAToffered, STATaccepted, STATrefused, STATrejected);
(void)printf("\n");
! (void)printf(STAT2, SITEname, usertime, systime, STATend - STATbegin);
(void)printf("\n");
}
syslog(L_NOTICE, STAT1,
! SITEname, STAToffered, STATaccepted, STATrefused, STATrejected);
! syslog(L_NOTICE, STAT2, SITEname, usertime, systime, STATend - STATbegin);
if (retries)
! syslog(L_NOTICE, "%s %lu Streaming retries", SITEname, retries);
if (BATCHfp != NULL && unlink(BATCHtemp) < 0 && errno != ENOENT)
(void)fprintf(stderr, "Can't remove \"%s\", %s\n",
***************
*** 818,824 ****
break;
case NNTP_RESENDIT_VAL:
case NNTP_GOODBYE_VAL:
! syslog(L_NOTICE, GOT_RESENDIT, REMhost, MessageID, REMclean(buff));
Requeue(Article, MessageID);
break;
case NNTP_TOOKIT_VAL:
--- 819,825 ----
break;
case NNTP_RESENDIT_VAL:
case NNTP_GOODBYE_VAL:
! syslog(L_NOTICE, GOT_RESENDIT, SITEname, MessageID, REMclean(buff));
Requeue(Article, MessageID);
break;
case NNTP_TOOKIT_VAL:
***************
*** 1052,1072 ****
hash = stidhash(id);
i = stindex(id, hash); /* find table entry */
if (i < 0) { /* should not happen */
! syslog(L_NOTICE, CANT_FINDIT, REMhost, REMclean(buff));
return (TRUE); /* can't find it! */
}
} else {
! syslog(L_NOTICE, CANT_PARSEIT, REMhost, REMclean(buff));
return (TRUE);
}
break;
case NNTP_GOODBYE_VAL:
/* Most likely out of space -- no point in continuing. */
! syslog(L_NOTICE, IHAVE_FAIL, REMhost, REMclean(buff));
return TRUE;
/* NOTREACHED */
default:
! syslog(L_NOTICE, UNEXPECTED, REMhost, REMclean(buff));
if (Debug)
(void)fprintf(stderr, "Unknown reply \"%s\"",
buff);
--- 1053,1073 ----
hash = stidhash(id);
i = stindex(id, hash); /* find table entry */
if (i < 0) { /* should not happen */
! syslog(L_NOTICE, CANT_FINDIT, SITEname, REMclean(buff));
return (TRUE); /* can't find it! */
}
} else {
! syslog(L_NOTICE, CANT_PARSEIT, SITEname, REMclean(buff));
return (TRUE);
}
break;
case NNTP_GOODBYE_VAL:
/* Most likely out of space -- no point in continuing. */
! syslog(L_NOTICE, IHAVE_FAIL, SITEname, REMclean(buff));
return TRUE;
/* NOTREACHED */
default:
! syslog(L_NOTICE, UNEXPECTED, SITEname, REMclean(buff));
if (Debug)
(void)fprintf(stderr, "Unknown reply \"%s\"",
buff);
***************
*** 1224,1229 ****
--- 1225,1232 ----
BATCHname = NEW(char, STRLEN(BATCHDIR) + 1 + strlen(av[1]) + 1);
(void)sprintf(BATCHname, "%s/%s", BATCHDIR, av[1]);
}
+ SITEname = strdup(strrchr(BATCHname, '/')) + 1;
+ *strrchr(SITEname, '.') = '\0';
if ((i = open(BATCHname, O_RDWR)) < 0
|| (BATCHqp = QIOfdopen(i, QIO_BUFFER)) == NULL) {
(void)fprintf(stderr, "Can't open \"%s\", %s\n",
***************
*** 1288,1296 ****
if (NNTPsendpassword(REMhost, From, To) < 0 || GotAlarm) {
i = errno;
(void)fprintf(stderr, "Can't authenticate with %s, %s\n",
! REMhost, strerror(errno));
syslog(L_ERROR, CANT_AUTHENTICATE,
! REMhost, GotAlarm ? "timeout" : strerror(i));
/* Don't send quit; we want the remote to print a message. */
exit(1);
}
--- 1291,1299 ----
if (NNTPsendpassword(REMhost, From, To) < 0 || GotAlarm) {
i = errno;
(void)fprintf(stderr, "Can't authenticate with %s, %s\n",
! SITEname, strerror(errno));
syslog(L_ERROR, CANT_AUTHENTICATE,
! SITEname, GotAlarm ? "timeout" : strerror(i));
/* Don't send quit; we want the remote to print a message. */
exit(1);
}
***************
*** 1589,1595 ****
case NNTP_RESENDIT_VAL:
case NNTP_GOODBYE_VAL:
/* Most likely out of space -- no point in continuing. */
! syslog(L_NOTICE, IHAVE_FAIL, REMhost, REMclean(buff));
RequeueRestAndExit(Article, MessageID);
/* NOTREACHED */
case NNTP_SENDIT_VAL:
--- 1592,1598 ----
case NNTP_RESENDIT_VAL:
case NNTP_GOODBYE_VAL:
/* Most likely out of space -- no point in continuing. */
! syslog(L_NOTICE, IHAVE_FAIL, SITEname, REMclean(buff));
RequeueRestAndExit(Article, MessageID);
/* NOTREACHED */
case NNTP_SENDIT_VAL:
--
Steve Waltner | Steve.Waltner@symbios.com
Symbios Logic | Phone: (316) 636-8498
3718 N. Rock Road | FAX: (316) 636-8889
Wichita, KS 67226 |
Technical Details
Message-ID:
<Steve.Waltner-0111961222080001@bart.ks.symbios.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <Steve.Waltner-0111961222080001@bart.ks.symbios.com> Subject: Patch for innxmit logging Date: Fri, 01 Nov 1996 00:00:00 +0000 From: Steve.Waltner@symbios.com (Steve Waltner) Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 193832453 Organization: Symbios Logic Newsgroups: news.software.nntp