Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Jan 2002 23:50:01 -0800 (PST)
From:      Archie Cobbs <archie@dellroad.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/32420: syslogd accumulates "repeated" messages when piping to programs when the program may want to take immediate action
Message-ID:  <200201050750.g057o1l61374@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/32420; it has been noted by GNATS.

From: Archie Cobbs <archie@dellroad.org>
To: freebsd-gnats-submit@FreeBSD.org
Cc: brett@lariat.org
Subject: Re: bin/32420: syslogd accumulates "repeated" messages when piping to
 programs when the program may want to take immediate action
Date: Fri, 4 Jan 2002 23:31:39 -0800 (PST)

 Here's a candidate patch.
 
 -Archie
 
 __________________________________________________________________________
 Archie Cobbs     *     Packet Design     *     http://www.packetdesign.com
 
 Index: usr.sbin/syslogd/syslogd.8
 ===================================================================
 RCS file: /home/ncvs/src/usr.sbin/syslogd/syslogd.8,v
 retrieving revision 1.43
 diff -u -r1.43 syslogd.8
 --- syslogd.8	8 Dec 2001 16:17:49 -0000	1.43
 +++ syslogd.8	5 Jan 2002 07:29:17 -0000
 @@ -156,6 +156,12 @@
  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
 Index: usr.sbin/syslogd/syslogd.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.sbin/syslogd/syslogd.c,v
 retrieving revision 1.93
 diff -u -r1.93 syslogd.c
 --- syslogd.c	27 Nov 2001 20:02:18 -0000	1.93
 +++ syslogd.c	5 Jan 2002 07:29:18 -0000
 @@ -274,6 +274,7 @@
  #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 @@
  	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 @@
  		case 'b':
  			bindhostname = optarg;
  			break;
 +		case 'c':
 +			no_compress++;
 +			break;
  		case 'd':		/* debug */
  			Debug++;
  			break;
 @@ -865,7 +869,8 @@
  		/*
  		 * 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);

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




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