Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Feb 1998 00:00:12 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        current@FreeBSD.ORG
Subject:   PATCH: new option for newsyslog
Message-ID:  <199802060000.RAA27563@usr09.primenet.com>

next in thread | raw e-mail | index | archive | help
When debugging problems that show up in the logs, it's useful to
be able to zero the logs.

But you don't want to lose the existing log data, you just want
to start over with a clean slate.

I have added a "-F" option ("Force") to newsyslog to force it
to rotate the logs, even if the rotation criteria have not been
met.

Here are the (trivial) patches to the program itself and to the
man page for the program.

Please commit these...

PS: still waiting for a "Bcc:" option for send-pr so I can Cc: a
copy of these bug reports to send-pr...


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.
---------------------------------------------------------------------------
Index: newsyslog.8
===================================================================
RCS file: /cvs/freebsd/src/usr.sbin/newsyslog/newsyslog.8,v
retrieving revision 1.9
diff -c -r1.9 newsyslog.8
*** newsyslog.8	1997/10/06 07:46:06	1.9
--- newsyslog.8	1998/02/05 23:30:44
***************
*** 152,157 ****
--- 152,163 ----
  will not be able to send a HUP signal to
  .Xr syslogd 8
  so this option should only be used in debugging.
+ .It Fl F
+ Force
+ .Nm
+ to trim the logs, even if the trim conditions have not been met.  This
+ option is useful for diagnosing system problems by providing you with
+ fresh logs that contain only the problems.
  .El
  .Sh FILES
  .Bl -tag -width /etc/newsyslog.confxxxx -compact
Index: newsyslog.c
===================================================================
RCS file: /cvs/freebsd/src/usr.sbin/newsyslog/newsyslog.c,v
retrieving revision 1.15
diff -c -r1.15 newsyslog.c
*** newsyslog.c	1997/11/30 18:58:18	1.15
--- newsyslog.c	1998/02/05 23:30:44
***************
*** 89,94 ****
--- 89,95 ----
  int     verbose = 0;            /* Print out what's going on */
  int     needroot = 1;           /* Root privs are necessary */
  int     noaction = 0;           /* Don't do anything, just show it */
+ int	force = 0;		/* Force the tim no matter what*/
  char    *conf = CONF;           /* Configuration file to use */
  time_t  timenow;
  pid_t   syslog_pid;             /* read in from /etc/syslog.pid */
***************
*** 159,165 ****
                          printf("size (Kb): %d [%d] ", size, ent->size);
                  if (verbose && (ent->hours > 0))
                          printf(" age (hr): %d [%d] ", modtime, ent->hours);
!                 if (((ent->size > 0) && (size >= ent->size)) ||
                      ((ent->hours > 0) && ((modtime >= ent->hours)
                                          || (modtime < 0)))) {
                          if (verbose)
--- 160,167 ----
                          printf("size (Kb): %d [%d] ", size, ent->size);
                  if (verbose && (ent->hours > 0))
                          printf(" age (hr): %d [%d] ", modtime, ent->hours);
!                 if (force ||
! 		    ((ent->size > 0) && (size >= ent->size)) ||
                      ((ent->hours > 0) && ((modtime >= ent->hours)
                                          || (modtime < 0)))) {
                          if (verbose)
***************
*** 201,207 ****
  	}
  
          optind = 1;             /* Start options parsing */
!         while ((c=getopt(argc,argv,"nrvf:t:")) != -1)
                  switch (c) {
                  case 'n':
                          noaction++; /* This implies needroot as off */
--- 203,209 ----
  	}
  
          optind = 1;             /* Start options parsing */
!         while ((c=getopt(argc,argv,"nrvFf:t:")) != -1)
                  switch (c) {
                  case 'n':
                          noaction++; /* This implies needroot as off */
***************
*** 215,220 ****
--- 217,225 ----
                  case 'f':
                          conf = optarg;
                          break;
+ 		case 'F':
+ 			force = 1;
+ 			break;
                  default:
                          usage();
                  }
---------------------------------------------------------------------------



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