The logrotate command enables logging files to be changed. logrotate analyzes the configuration file of the syslog daemon (by default /etc/syslog.conf), searching in it for all logging files which are used by the syslog daemon. logrotate creates copies of these logging files whose file names are formed from the original file names with the suffix “0”. If copies exist from previous changes of the logging files, the suffix in each name is incremented by 1, beginning with the name that is numerically highest. In other words <logfile>.<n> becomes <logfile>.<n+1>, ..., <logfile>.0 becomes <logfile>.1 and <logfile> becomes <logfile>.0. A maximum of four preceding logging files (suffixes ".0" through ".3") are stored. Older logging files are deleted.
The current <logfile> file is not deleted, but emptied after copying.
The syslog daemon is then caused to close the open logging files and to open new ones.
The logrotate -n 1
command is called automatically when the POSIX subsystem is terminated and started.
Further information is provided in the sections “POSIX logging files” in the manual "POSIX Basics for Users and System Administrators" [1].
Syntax
logrotate [-f config_file] [-n line_num] |
With this option the configuration file must be specified if a configuration file other than /etc/syslog.conf was defined for the syslog daemon, e.g. by changing its rc scripts.
Execution of logrotate is restricted to files which contain at least the specified number of lines. |
File
/usr/sbin/logrotate /etc/syslog.conf |