Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jun 1998 18:00:01 -0700 (PDT)
From:      Archie Cobbs <archie@whistle.com>
To:        freebsd-bugs@FreeBSD.ORG
Subject:   Re: bin/6292: [PATCH] syslogd cannot put kernel loggings into separate files
Message-ID:  <199806100100.SAA03639@freefall.freebsd.org>

index | next in thread | raw e-mail

The following reply was made to PR bin/6292; it has been noted by GNATS.

From: Archie Cobbs <archie@whistle.com>
To: freebsd-gnats-submit@freebsd.org
Cc:  Subject: Re: bin/6292: [PATCH] syslogd cannot put kernel loggings into separate files
Date: Tue, 9 Jun 1998 17:58:01 -0700 (PDT)

 Here is a better patch that works for both log() and printf() from
 within the kernel, as well as a man page update.
 
 -Archie
 
 ___________________________________________________________________________
 Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com
 
 Index: syslog.conf.5
 ===================================================================
 RCS file: /cvs/freebsd/src/usr.sbin/syslogd/syslog.conf.5,v
 retrieving revision 1.9
 diff -c -r1.9 syslog.conf.5
 *** syslog.conf.5	1997/10/20 12:55:47	1.9
 --- syslog.conf.5	1998/06/10 00:57:28
 ***************
 *** 114,120 ****
   (the former is for compatibility with the previous syslogd, if one is sharing
   syslog.conf files, for example)
   and each block will be associated with calls to syslog from that specific
 ! program.
   .Pp
   See
   .Xr syslog 3
 --- 114,121 ----
   (the former is for compatibility with the previous syslogd, if one is sharing
   syslog.conf files, for example)
   and each block will be associated with calls to syslog from that specific
 ! program. A tag for ``foo'' will also match any message logged by the kernel
 ! with the prefix ``foo: ''.
   .Pp
   See
   .Xr syslog 3
 ***************
 *** 294,299 ****
 --- 295,304 ----
   # Save ftpd transactions along with mail and news
   !ftpd
   *.*							/var/log/spoolerr
 + 
 + # Log kernel firewall reports to a separate file
 + !ipfw
 + *.*							/var/log/ipfw
   .Ed
   .Sh FILES
   .Bl -tag -width /etc/syslog.conf -compact
 Index: syslogd.c
 ===================================================================
 RCS file: /cvs/freebsd/src/usr.sbin/syslogd/syslogd.c,v
 retrieving revision 1.32
 diff -c -r1.32 syslogd.c
 *** syslogd.c	1998/05/19 12:02:41	1.32
 --- syslogd.c	1998/06/10 00:57:29
 ***************
 *** 543,552 ****
   	int c, pri, flags;
   	char *lp, *p, *q, line[MAXLINE + 1];
   
 - 	(void)strcpy(line, bootfile);
 - 	(void)strcat(line, ": ");
 - 	lp = line + strlen(line);
   	for (p = msg; *p != '\0'; ) {
   		flags = SYNC_FILE | ADDDATE;	/* fsync file after write */
   		pri = DEFSPRI;
   		if (*p == '<') {
 --- 543,551 ----
   	int c, pri, flags;
   	char *lp, *p, *q, line[MAXLINE + 1];
   
   	for (p = msg; *p != '\0'; ) {
 + 
 + 		/* Get message priority, if any */
   		flags = SYNC_FILE | ADDDATE;	/* fsync file after write */
   		pri = DEFSPRI;
   		if (*p == '<') {
 ***************
 *** 561,566 ****
 --- 560,577 ----
   		}
   		if (pri &~ (LOG_FACMASK|LOG_PRIMASK))
   			pri = DEFSPRI;
 + 
 + 		/* See if kernel provided a prefix; if not, use kernel name */
 + 		for (q = p; *q && isalnum(*q); q++);
 + 		if (*q == ':') {
 + 			lp = line;
 + 		} else {
 + 			(void)strcpy(line, bootfile);
 + 			(void)strcat(line, ": ");
 + 			lp = line + strlen(line);
 + 		}
 + 
 + 		/* Append message body to prefix */
   		q = lp;
   		while (*p != '\0' && (c = *p++) != '\n' &&
   		    q < &line[MAXLINE])

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806100100.SAA03639>