1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-06 09:17:25 +00:00

Allow syslogd to separate out kernel log messages with a known

category.
e.g. separate out ipfw entries to a separate file.

Reviewed by:	(briefly) phk
Submitted by:	archie@whistle.com
Obtained from:	Whistle source tree
This commit is contained in:
Julian Elischer 1998-06-10 04:34:56 +00:00
parent 363e8996d7
commit d2b4b1fa20
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=36837
2 changed files with 22 additions and 6 deletions

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)syslog.conf.5 8.1 (Berkeley) 6/9/93
.\" $Id: syslog.conf.5,v 1.8 1997/10/06 20:37:50 joerg Exp $
.\" $Id: syslog.conf.5,v 1.9 1997/10/20 12:55:47 charnier Exp $
.\"
.Dd June 9, 1993
.Dt SYSLOG.CONF 5
@ -114,7 +114,8 @@ or
(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.
program. A tag for ``foo'' will also match any message logged by the kernel
with the prefix ``foo: ''.
.Pp
See
.Xr syslog 3
@ -294,6 +295,10 @@ auth.* |exec /usr/local/sbin/authfilter
# 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

View File

@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94";
#endif
static const char rcsid[] =
"$Id: syslogd.c,v 1.31 1998/05/07 00:39:56 brian Exp $";
"$Id: syslogd.c,v 1.32 1998/05/19 12:02:41 phk Exp $";
#endif /* not lint */
/*
@ -543,10 +543,9 @@ printsys(msg)
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'; ) {
/* Get message priority, if any */
flags = SYNC_FILE | ADDDATE; /* fsync file after write */
pri = DEFSPRI;
if (*p == '<') {
@ -561,6 +560,18 @@ printsys(msg)
}
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])