Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/syslogd Implement -r, which prevents syslogd from c...
details: https://anonhg.NetBSD.org/src/rev/acab63f5cd84
branches: trunk
changeset: 553453:acab63f5cd84
user: lukem <lukem%NetBSD.org@localhost>
date: Fri Oct 17 01:39:25 2003 +0000
description:
Implement -r, which prevents syslogd from compressing multiple messages with
the same string into "last message repeated N times", and instead forces
syslogd to write out every message.
Based on '-c' in FreeBSD's syslogd, although a different option letter was
chosen because their syslogd requires '-c -c' to get this functionality,
and we don't have the support for logging to pipes which is what FreeBSD's
syslogd with a single '-c' is related to.
diffstat:
usr.sbin/syslogd/syslogd.8 | 10 +++++++---
usr.sbin/syslogd/syslogd.c | 15 ++++++++++-----
2 files changed, 17 insertions(+), 8 deletions(-)
diffs (104 lines):
diff -r 1e57522028a5 -r acab63f5cd84 usr.sbin/syslogd/syslogd.8
--- a/usr.sbin/syslogd/syslogd.8 Fri Oct 17 00:20:28 2003 +0000
+++ b/usr.sbin/syslogd/syslogd.8 Fri Oct 17 01:39:25 2003 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: syslogd.8,v 1.32 2003/08/07 11:25:44 agc Exp $
+.\" $NetBSD: syslogd.8,v 1.33 2003/10/17 01:39:25 lukem Exp $
.\"
.\" Copyright (c) 1983, 1986, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" from: @(#)syslogd.8 8.1 (Berkeley) 6/6/93
.\"
-.Dd May 25, 2002
+.Dd October 17, 2003
.Dt SYSLOGD 8
.Os
.Sh NAME
@@ -37,7 +37,7 @@
.Nd log systems messages
.Sh SYNOPSIS
.Nm
-.Op Fl dns
+.Op Fl dnrs
.Bk -words
.Op Fl f Ar config_file
.Ek
@@ -98,6 +98,10 @@
arguments are created, the default socket of
.Pa /var/run/log
is used.
+.It Fl r
+Disable the compression of repeated instances of the same line
+into a single line of the form
+.Dq last message repeated N times .
.It Fl s
Select
.Dq secure
diff -r 1e57522028a5 -r acab63f5cd84 usr.sbin/syslogd/syslogd.c
--- a/usr.sbin/syslogd/syslogd.c Fri Oct 17 00:20:28 2003 +0000
+++ b/usr.sbin/syslogd/syslogd.c Fri Oct 17 01:39:25 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: syslogd.c,v 1.62 2003/10/16 06:22:09 itojun Exp $ */
+/* $NetBSD: syslogd.c,v 1.63 2003/10/17 01:39:25 lukem Exp $ */
/*
* Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94";
#else
-__RCSID("$NetBSD: syslogd.c,v 1.62 2003/10/16 06:22:09 itojun Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.63 2003/10/17 01:39:25 lukem Exp $");
#endif
#endif /* not lint */
@@ -197,6 +197,7 @@
int UseNameService = 1; /* make domain name queries */
int NumForwards = 0; /* number of forwarding actions in conf file */
char **LogPaths; /* array of pathnames to read messages from */
+int NoRepeat = 0; /* disable "repeated"; log always */
void cfline(char *, struct filed *);
char *cvthname(struct sockaddr_storage *);
@@ -240,7 +241,7 @@
(void)setlocale(LC_ALL, "");
- while ((ch = getopt(argc, argv, "dnsf:m:p:P:u:g:t:")) != -1)
+ while ((ch = getopt(argc, argv, "dnsf:m:p:P:ru:g:t:")) != -1)
switch(ch) {
case 'd': /* debug */
Debug++;
@@ -267,6 +268,9 @@
logpath_fileadd(&LogPaths, &funixsize,
&funixmaxsize, optarg);
break;
+ case 'r': /* disable "repeated" compression */
+ NoRepeat++;
+ break;
case 's': /* no network listen mode */
SecureMode++;
break;
@@ -554,7 +558,7 @@
{
(void)fprintf(stderr,
- "usage: %s [-dns] [-f config_file] [-g group] [-m mark_interval]\n"
+ "usage: %s [-dnrs] [-f config_file] [-g group] [-m mark_interval]\n"
"\t[-P file_list] [-p log_socket [-p log_socket2 ...]]\n"
"\t[-t chroot_dir] [-u user]\n", getprogname());
exit(1);
@@ -767,9 +771,10 @@
continue;
/*
- * suppress duplicate lines to this file
+ * suppress duplicate lines to this file unless NoRepeat
*/
if ((flags & MARK) == 0 && msglen == f->f_prevlen &&
+ !NoRepeat &&
!strcmp(msg, f->f_prevline) &&
!strcmp(from, f->f_prevhost)) {
(void)strncpy(f->f_lasttime, timestamp, 15);
Home |
Main Index |
Thread Index |
Old Index