|NEWSYSLOG(8)||System Manager's Manual||NEWSYSLOG(8)|
newsyslog.conf — rotate log
newsyslog utility rotates log files
when they exceed a configurable size or age. The log
file is renamed to log.0 and an empty file is
created in its place. An archive of older logs may be kept: in order of
increasing age, these files are named log.1,
log.2, and so on. When their number exceeds a given
limit, the oldest is removed. The archived logs may also be compressed.
The options are as follows:
-aoption was not specified.
newsyslogto trim logs regardless of the size and/or age requirements specified in /etc/newsyslog.conf. This option may be combined with the
-vflags to aid in debugging problems with /etc/newsyslog.conf.
newsyslogwas run with the
-mflag is mailed to the user listed in the monitor notification section.
newsyslogmust be running as root. Note that in this mode
newsyslogwill not be able to send a
SIGHUPsignal to syslogd(8).
newsyslogin verbose mode. In this mode it will print out each log and its reasons for either trimming that log or skipping it.
In the default system configuration,
newsyslog is run by
cron(8), but it may also be run manually.
If one or more log files are specified on the command
line, only the specified files are rotated. Note that each
log specified must have an entry in
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 in cron(8). Since the program is
quite fast, it may be scheduled to run every hour without any ill
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. Each
line of the file contains information about a particular log file that
should be handled by
newsyslog. Each line has five
mandatory fields and up to three optional fields, with whitespace separating
each field. Blank lines or lines beginning with a hash mark
#’) are ignored. The fields of the
configuration file are as follows:
:’ is essential, even if the owner or group field is left blank. The fields may be numeric, or a name which is looked up in the system password and group databases. For backwards compatibility, a ‘
.’ may be used instead of a ‘
:’. If either owner or group is not specified, the owner and/or group of the existing log file is used.
*’, or set to ‘
0’, then the size of the log file is not taken into account when determining when to trim the log file. By default, files smaller than 256 bytes are not rotated unless the ‘B’ (binary) flag is set or the
-Foption is specified. This prevents
newsyslogfrom rotating files consisting solely of a message indicating that the log file has been turned over.
*’), log rotation will depend only on the contents of the size field. Otherwise, the when field consists of an optional interval in hours, possibly followed by an ‘
@’-sign and a time in a restricted ISO 8601 format or by a ‘
$’-sign and a time specification for logfile rotation at a fixed time once per day, per week or per month.
If a time is specified, the log file will only be trimmed if
newsyslog is run within one hour of the
specified time. If an interval is specified, the log file will be
trimmed if that many hours have passed since the last rotation. When
both a time and an interval are specified, both conditions must be
satisfied for the rotation to take place.
There is no provision for the specification of a time zone. There is little point in specifying an explicit minutes or seconds component in the current implementation, since the only comparison is ‘within the hour’.
ISO 8601 restricted time format: The lead-in
character for a restricted ISO 8601 time is an
@’-sign. The particular format of
the time in restricted ISO 8601 is:
Optional date fields default to the appropriate component of the current
date; optional time fields default to midnight. For example, if today is
January 22, 1999, the following date specifications are all
Day, week and month time format: The lead-in
character for day, week and month specification is a dollar sign ($).
The particular format of day, week and month specification is:
respectively. Optional time fields default to midnight. The ranges for
day and hour specifications are:
newsysloginserts to indicate the fact that the logs have been turned over should not be included. The ‘M’ flag marks this entry as a monitored log file. The ‘F’ flag specifies that symbolic links should be followed.
SIGHUP) to instead of /var/run/syslog.pid.
SIGHUP. Signal names must start with “SIG” and be the signal name, not the number, e.g.,
"’). The empty string, ‘
""’, can be used to prevent
newsyslogfrom sending a signal or running a command. You cannot specify both a command and a PID file. NOTE: If you specify a command to be run,
newsyslogwill not send a
newsyslog utility exits 0 on
success, and >0 if an error occurs.
Theodore Ts'o, MIT Project Athena
Copyright 1987, Massachusetts Institute of Technology
|July 20, 2017||OpenBSD-current|