|
-M
|
-i interval
[-m
|
]
[-T HH:MM]
[-Fdnrv]
[-f config_file]
[-p syslogd_pidfile]
[log_file ...]
log_file
''
is empty,
``
log_file.0
''
has the last period's logs in it,
``
log_file.1
''
has the next to last period's logs in it, and so on, up to a
user-specified number of archived logs. The archived logs may also be
compressed to save space. After all file operations are done
newsyslog
notifies the
syslogd
daemon, or optionally some log-file specific daemon, by sending a
SIGHUP
to the daemon process.
A log can be archived because of two reasons. The log file can have grown bigger than a preset size in kilobytes, or a preset number of hours may have elapsed since the last log archive. The granularity of newsyslog is dependent on how often it is scheduled to run by cron. Since the program is quite fast, it may be scheduled to run at least every ten minutes without any ill effects. However even more frequent runs may be necessary to catch extremely fast growing log files when files are trimmed by size, and newsyslog may be run as often as every minute without harm to facilitate this need.
When starting up,
newsyslog
reads in a configuration file to determine which logs should be looked
at. By default, this configuration file is
/etc/newsyslog.conf
.
Note that a POSIX advisory lock is obtained on the configuration file
using the
open(2)
O_EXLOCK
flag. This both prevents simultaneous execution of
newsyslog
using the same configuration file, as well as preventing the reading of
the file while it is being modified by any text editor which uses the
same locking feature (for example
vi(1)).
If any log_file parameters are given then processing is restricted to just the specified files. The control specifications for the specified files are taken from the configuration file. Any files specified which do not correspond to entries in the configuration file will be ignored.
/etc/newsyslog.conf
for its configuration file.
This option can be useful to initialize a freshly installed system with initial archive copies to ensure reliable interval calculation based on the age of the most recent archive file. This option can also be useful to mark an important system milestone in all logs newsyslog manages.
This option is deprecated and will be removed in the next major release.
This option is deprecated and will be removed in the next major release.
/var/run/syslogd.pid
as the PID file for
syslogd.
/etc/rc.d/newsyslog
script.
/etc/newsyslog.conf
/var/run/syslogd.pid
Someone at OSF hacked on it too.
A newsyslog command appeared in 4.4BSD.
There was an extremely simple shell script of similar purpose,
/usr/lib/newsyslog
,
in SunOS-4.1.
This particular version's feature set, and this separate manual page for
the configuration file, was put together by
Greg A. Woods
,
Planix, Inc.
Copyright 1987, Massachusetts Institute of Technology
This version by
Greg A. Woods
,
Planix, Inc.
newsyslog sends SIGHUP to the associated daemon process for every log file trimmed. This is done to ensure that it's safe to compress the file after it has hopefully been closed. In theory we could try to optimize this procedure to only notify the daemon(s) once (and of course to batch all the compression commands at the end of the run). The current behaviour is normally harmless for syslogd and multiple signals can be avoided for other daemons by ensuring their PID files are only listed once with the last associated log file and that the 0 flag is used to ensure the most recent log file is not immediately compressed. Note that daemons which have multiple log files open may requirer signalling every time any one of their logs are rolled over anyway, especially if their different logs have different roll-over policies.