summaryrefslogtreecommitdiffstats
path: root/usr.sbin/syslogd
diff options
context:
space:
mode:
authorarchie <archie@FreeBSD.org>2002-01-05 07:34:52 +0000
committerarchie <archie@FreeBSD.org>2002-01-05 07:34:52 +0000
commitcd1ab6120870fd140e7a9be8b59780deff770903 (patch)
treeb04c15a14cefbd8aed5650d933e1a41f6a76d47f /usr.sbin/syslogd
parent9c8997afd25e682ec48e3f1b18e447f94432912f (diff)
downloadFreeBSD-src-cd1ab6120870fd140e7a9be8b59780deff770903.zip
FreeBSD-src-cd1ab6120870fd140e7a9be8b59780deff770903.tar.gz
Add a new flag '-c' to disable repeated line compression when the output
is a pipe to another program, or, if specified twice, in all cases. PR: bin/32420
Diffstat (limited to 'usr.sbin/syslogd')
-rw-r--r--usr.sbin/syslogd/syslogd.86
-rw-r--r--usr.sbin/syslogd/syslogd.c9
2 files changed, 13 insertions, 2 deletions
diff --git a/usr.sbin/syslogd/syslogd.8 b/usr.sbin/syslogd/syslogd.8
index cfa2a51..7807a6b 100644
--- a/usr.sbin/syslogd/syslogd.8
+++ b/usr.sbin/syslogd/syslogd.8
@@ -156,6 +156,12 @@ option is also specified.
Specify one specific IP address or hostname to bind to.
If a hostname is specified,
the IPv4 or IPv6 address which corresponds to it is used.
+.It Fl c
+Disable the compression of repeated instances of the same line
+into a single line of the form
+.Dq last message repeated N times
+when the output is a pipe to another program.
+If specified twice, disable this compression in all cases.
.It Fl d
Put
.Nm
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index 0cfa84c..9a534e3 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -274,6 +274,7 @@ int family = PF_INET; /* protocol family (IPv4 only) */
#endif
int send_to_all = 0; /* send message to all IPv4/IPv6 addresses */
int use_bootfile = 0; /* log entire bootfile for every kern msg */
+int no_compress = 0; /* don't compress messages (1=pipes, 2=all) */
char bootfile[MAXLINE+1]; /* booted kernel file */
@@ -334,7 +335,7 @@ main(argc, argv)
socklen_t len;
bindhostname = NULL;
- while ((ch = getopt(argc, argv, "46Aa:b:df:kl:m:nop:P:suv")) != -1)
+ while ((ch = getopt(argc, argv, "46Aa:b:cdf:kl:m:nop:P:suv")) != -1)
switch (ch) {
case '4':
family = PF_INET;
@@ -354,6 +355,9 @@ main(argc, argv)
case 'b':
bindhostname = optarg;
break;
+ case 'c':
+ no_compress++;
+ break;
case 'd': /* debug */
Debug++;
break;
@@ -865,7 +869,8 @@ logmsg(pri, msg, from, flags)
/*
* suppress duplicate lines to this file
*/
- if ((flags & MARK) == 0 && msglen == f->f_prevlen &&
+ if (no_compress - (f->f_type != F_PIPE) < 1 &&
+ (flags & MARK) == 0 && msglen == f->f_prevlen &&
!strcmp(msg, f->f_prevline) &&
!strcasecmp(from, f->f_prevhost)) {
(void)strlcpy(f->f_lasttime, timestamp, 16);
OpenPOWER on IntegriCloud