Commit Graph

269 Commits

Author SHA1 Message Date
Maxim Sobolev
2e01a2be1e Add a new newsyslog.conf flag - 'G', which if set tells newsyslog(8) that
the specified filename of the log to be rotated is in fact shell glob
pattern. In this case, all files matching this pattern will be rotated
using the same options. Useful in the case when there is no pre-defined
name for the logfiles (e.g. xtradius, samba etc).

Sponsored by:	PortaOne Software Ltd
MFC after:	2 weeks
2002-11-14 08:43:07 +00:00
Maxim Konovalov
a9a25f59fa Fix getopt(3) optstring: remove a flag we does not handle.
PR:		bin/44066
Submitted by:	Stefan Farfeleder <e0026813@stud3.tuwien.ac.at>
MFC after:	1 week
2002-10-16 14:20:20 +00:00
Philippe Charnier
490d5836b5 The .Nm utility 2002-07-14 14:47:15 +00:00
Maxim Konovalov
21ee796112 Remove the last EOF spaces I missed in rev. 1.43.
MFC after:	1 week
2002-07-01 13:18:52 +00:00
Maxim Konovalov
cc37581539 style(9): sort includes, remove EOL spaces.
MFC after:	1 week
2002-05-03 21:03:37 +00:00
Maxim Konovalov
021e53b8df wait(2) for compress_log() processes to complete before exit.
Spotted by:	Grigoriy Strokin <grg@isabase.philol.msu.ru>
Reviewed by:	-current
MFC after:	1 month
2002-05-03 20:53:37 +00:00
Sheldon Hearn
669d663174 Close a very small window during which new (empty) instances of rotated log
files are owned by the caller of newsyslog (usually root:wheel) even if
alternative ownerships were specified in newsyslog.conf.

Note that this is part of a wider problem which is fully addressed in
OpenBSD.  Anyone with the time and inclination to incorporate the full
fix for the wider problem will receive no complaints from me and should
feel free to walk all over this delta.

PR:		bin/36738
MFC after:	1 week
2002-04-10 10:38:44 +00:00
Crist J. Clark
aeeb2b2bbb Produce a different error message for mktime(3) failure than for bad
newsyslog.conf syntax.

PR:		bin/36641
2002-04-02 12:03:16 +00:00
Peter Pentchev
115f46ff8f Fix -F with logfiles rotated on time only.
Approved by:	silence on -audit
MFC after:	1 month
2002-02-05 09:33:07 +00:00
David E. O'Brien
a4482d5ce1 Fix the type of the NULL arg to execl(). 2001-11-14 17:00:58 +00:00
Ruslan Ermilov
eb6626f52a WARNS= -> WARNS?= 2001-09-21 07:25:53 +00:00
David E. O'Brien
904cc0c45c jhb says a 10 line change containing casts is more invasive than a 28 line
change.
2001-07-31 16:25:55 +00:00
David E. O'Brien
f1d4135bd9 Use the POSIX syntax for chown.
Submmited by:	garrett
2001-07-30 23:26:19 +00:00
Garrett Wollman
ef404327b0 Simplify (and hopefully clarify) some date-parsing arithmetic. 2001-07-30 18:27:21 +00:00
David E. O'Brien
4c9237c908 style(9) 2001-07-30 16:27:16 +00:00
David E. O'Brien
9674b13dcb WARNS-2'ify.
(this included removing the funny "if (unsigned_var < 0)" test)
2001-07-30 15:41:20 +00:00
David E. O'Brien
e12f0d2fac Add the ability to Bzip2 your logs.
PR:		27901
Submitted by:	Anders Nordby <anders@fix.no> (stylistic changes by me)
2001-07-30 15:17:17 +00:00
David E. O'Brien
90e655ea4e Perform a major cleanup of the usr.sbin Makefiles.
These are not perfectly in agreement with each other style-wise, but they
are orders of orders of magnitude more consistent style-wise than before.
2001-07-20 06:20:32 +00:00
Garrett Wollman
9fb54cb322 Note the equivalence of certain time formats. 2001-07-19 15:52:02 +00:00
Dima Dorfman
5d88e21a2a Instead of giving an example of rotating logs at the end of the month,
give an example of how to rotate logs at the beginning of the month.
Although they sound the same, since both of them rotate logs at the
beginning of the day, the former ended up taking place on, e.g., July
31 00:00 instead of the expected July 31 23:59.  This is contraty to POLA.

Submitted by:	Dan Langille <dan@langille.org>
2001-07-19 11:18:42 +00:00
Dima Dorfman
f247324df7 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
Brian Somers
7bc6d0158f Fix the type of the NULL arg to execl()
Idea from: Theo de Raadt <deraadt@openbsd.org>
2001-07-09 09:24:06 +00:00
Dima Dorfman
1818ea96a7 Fix a grammar bogon. 2001-04-02 06:21:13 +00:00
Ruslan Ermilov
345e52e742 - Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:42:20 +00:00
Ruslan Ermilov
c73e22c3d4 Set the default manual section for usr.sbin/ to 8. 2001-03-20 18:17:26 +00:00
Ruslan Ermilov
610a5778c5 mdoc(7) police: split punctuation characters + misc fixes. 2001-02-01 16:44:04 +00:00
Chris D. Faulhaber
3c0cec43e7 - Correct MAXPATHLEN/MAXHOSTNAMELEN usage
- Check return values of malloc() and strdup()
- Replace strcpy()/strcat()/sprintf() usage with strlcpy()/snprintf

Reviewed by:	-audit
2001-01-20 17:36:08 +00:00
Ruslan Ermilov
e97407b4f2 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 20:10:44 +00:00
Josef Karthauser
6b9a6e1f20 When warning that a log file can't be compressed, tell the reader which
log file it was.
2000-08-15 09:34:41 +00:00
Dag-Erling Smørgrav
78ae26252e Allow user to specify which logs to rotate 2000-05-11 10:17:54 +00:00
Hellmuth Michaelis
70fa0440ad - implement logfile archivation to a separate, user
configurable directory
- implement alternate and more flexible way to specify
  logfile rotation time in addition to the ISO 8601
  restricted format
- cleanup the source which was a mix of several styles
  of persons who maintained it so far, ran through
  knfom script got from bde.

Reviewed by: (in part) sheldonh and garyj
2000-04-04 08:50:01 +00:00
Hellmuth Michaelis
c7c83aedf5 Run newsyslog source through knfom script obtained from Bruce Evans.
Joerg Wunsch suggested to do this to make the functional changes in
the next commit to newsyslog (which were run through the same script)
better visible.
2000-04-04 08:38:30 +00:00
Sheldon Hearn
f2e366a105 Remove single-space hard sentence breaks. These degrade the quality
of the typeset output, tend to make diffs harder to read and provide
bad examples for new-comers to mdoc.
2000-03-01 14:09:25 +00:00
Philippe Charnier
a39d9a0c5a .Nm corrections 1999-11-27 16:57:27 +00:00
Peter Wemm
97d92980a9 $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
David E. O'Brien
d00fc946ed Correctly refer to the companion program rather than as "chown".
Clean up wording a little (like I have any idea what real English looks like...)
1999-07-28 04:28:05 +00:00
David E. O'Brien
ae2c5cf197 Go back to allowing ``.'' as a username.group separator for backward
compatibility.  : is still the documented non-ambiguous approach.  The
algorithm used will correctly parse david.obrien.staff as strrchar() is
used, and in my mind more people would use a ``.'' in the username than
the group name.

Convinced by argument and patch by: sheldonh (with slight changes by me)
1999-07-28 04:26:10 +00:00
David E. O'Brien
63b5983b9e Syntax for user/group is changed from "user.group" to "user:group" to be
consistant with chown(8).
1999-06-28 03:15:02 +00:00
Chuck Robey
06497d232b Fix description of size, it's in kilobytes, not bytes. 1999-04-10 15:09:07 +00:00
Garrett Wollman
e288508dc3 jkoshy forgot up update the heading date on the man page. 1999-01-28 19:56:05 +00:00
Joseph Koshy
ad088da187 Note that the 'owner.group' field is optional in the config file.
PR:		docs/9602
Submitted by:	Kazuo Horikawa <horikawa@jp.freebsd.org>
1999-01-27 04:27:49 +00:00
Garrett Wollman
8fba304b43 A slight bit of code and doco cleanup, but mostly:
Add the much-needed and long-desired ability to force the log rotation
to take place on a specific day or time, and document same.  This works
by extending the syntax of the `when' field to allow a restricted
ISO 8601 time specification, and performing the log rotation if newsyslog
is run during the same hour as is specified.
1999-01-22 19:38:39 +00:00
Peter Wemm
ab65c1d9b0 The largest PID is now 99999
Reported by: Ben Stuyts <ben@stuyts.nl>
1998-12-23 12:03:33 +00:00
David E. O'Brien
2887f586f0 Remove useless `BINOWN=root' now that it is the default. 1998-09-19 22:42:14 +00:00
Andrey A. Chernov
dc55fe4c05 Add optional config file field: signal number to send (defaulted to HUP)
F.e. apache restarts less agressively  on USR1 then on HUP
1998-06-09 18:24:04 +00:00
Tim Vanderhoek
b2805b78b6 1) kill -HUP syslog, even if compressing supposedly "binary" files
PR:	docs/6385

2) -n (noaction) does not imply -r (run as non-root), since as of
   Rev. 1.12 (ache), -r changes actual behaviour.

3) missing \n from if(noaction) messages.
1998-05-10 21:13:29 +00:00
Tim Vanderhoek
28a9b05b87 Arg! Someone fixed the synopsis in -stable's newsyslog.8, but not
in -current.  However, they fixed both the ordering and the missing -F
flag.  Merge from 22 and fix ordering here, too.
1998-05-10 19:04:06 +00:00
Tim Vanderhoek
b813e9a54a Fix the usage here, too (-F option).
Typo fix in comment ("Force the tim now matter what" s/tim/trim/)
1998-05-10 18:47:50 +00:00
Tim Vanderhoek
cd6f8bd276 1) Remove a line that somehow strayed from the one true path of
its sentence.
2) Fix usage (-F option).
1998-05-10 18:41:16 +00:00
Philippe Charnier
f12a14713b .Sh AUTHOR -> .Sh AUTHORS. Use .An/.Aq. 1998-03-23 08:31:20 +00:00
Paul Traina
07d95a3e31 Add "-F" (force) flag to newsyslog.
Submitted by:	Terry Lambert <terry@freebsd.org>
1998-03-14 22:28:25 +00:00
Andrey A. Chernov
19df0544a0 Sleep 10secs after kill -HUP instead of 3secs, some daemons like Apache
may have log time to re-configure
1997-11-30 18:58:18 +00:00
Philippe Charnier
b8981f4416 Cosmetic in err() strings. 1997-10-06 07:46:08 +00:00
Steve Price
681e5e7a09 Show the real revision date and not the date that this
manpage is being viewed.
1997-06-23 04:03:49 +00:00
Brian Somers
ea3b35174b Allow a '-' flag as a placeholder so that path_to_pid_file
can be specified without the flags field.
Fix bogus "trail" left in parse routine where the code jumps
past the end of the line and wanders into oblivion.
1997-05-06 23:11:06 +00:00
Andrey A. Chernov
805bd6d982 Do not kill -HUP syslog if running in user mode (-r), it allows
private user logs rotation without error diagnostics
1997-05-05 15:00:15 +00:00
Andrey A. Chernov
3d807d3be6 1) Add yet one optional field: pid file to send SIGHUP to if log rotated
(good thing for apache f.e.) This change is backward compatible with old
newsyslog.conf files.

2) Do not compress log if SIGHUP sending failed for some reason
(f.e. pid file deleted). Newcoming messages will be lost
otherwise.

3) Misc cleanup while I am here.
1997-05-04 01:53:53 +00:00
Warner Losh
6c3f552a31 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-31 05:11:47 +00:00
Mike Pritchard
c26d7157df Add a missing period so that the -n option is display properly
in the man page output.  Closes PR# 2831.

Submitted by:	 Marc Slemko <marcs@znep.com>
1997-02-28 07:33:37 +00:00
Peter Wemm
476602a9d0 Revert $FreeBSD$ to $Id$ 1997-02-22 16:15:28 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Mike Pritchard
747f0006ca Convert to mdoc format. 1996-12-21 21:57:21 +00:00
Jordan K. Hubbard
2252262f79 Doh! Actually read the patch I applied and see what it was *trying* to do,
then make it do that.
Error-of-my-ways-pointed-out-by: Bob Willcox <bob@luke.pmr.com>
1996-09-09 15:32:26 +00:00
Jordan K. Hubbard
8e1d470afc PR#2724 in NetBSD notes that newsyslog save log files even if the number
of copies to save is zero.  Incorporate suggested fix with some stylistic
cleanup to make the resulting code more readable.
Submitted-By: Kenneth Stailey <kstailey@dol-esa.gov>
1996-09-06 06:36:07 +00:00
Alexander Langer
c8d7d3dbe3 Added function prototypes and removed in-line prototypes of standard
functions such as malloc and time.
1996-06-08 23:32:10 +00:00
Alexander Langer
d442994ef5 Fix uninitialized variable that caused a core dump if /etc/newsyslog.conf
was empty.  Closes PR bin/1300.

Found by: Brian Tao <taob@io.org>
1996-06-07 16:27:28 +00:00
Thomas Graichen
9bf204a77e Submitted by: charnier@lirmm.fr (Philippe Charnier)
1) correct MAX_PID according to system definition.
2) replace fprintf(stderr,...)/perror/exit by 4.4 equivalence.
3) make strings enough larger so they can't overflow: MAXHOSTNAMELEN for
   host and MAXPATHLEN for filenames.
4) call execl with correct parameters (compress -> gzip).
1996-01-16 10:32:04 +00:00
Thomas Graichen
c6bf200d31 Obtained from: NetBSD (PR#1906)
removed date formatting glitch in newsyslog
1996-01-09 08:40:08 +00:00
Thomas Graichen
abf212be33 Obtained from: NetBSD
imported the newsyslog command from NetBSD - it make the "rotation" of
the logfiles much simpler (it is currently done by "hand" in the
/etc/[daily,weekly,monthly] scripts) - now it will be done by invoking
newsyslog every hour which is very customizable via a
/etc/newsyslog.conf file
1996-01-05 09:28:11 +00:00