Name

logrotate

Synopsis

logrotate [options] config_files

System administration command. Manipulate logfiles according to commands given in config_files.

Options

-d, --debug

Debug mode. No changes will be made to logfiles.

-f, --force

Force rotation of logfiles.

-h, --help

Describe options.

-m command, --mail command

Use the specified command to mail logfiles. The default command is /bin/mail -s.

-s file, --state file

Save state information in file. The default is /var/lib/logrotate.status.

--usage

Show syntax and options.

-v, --verbose

Describe what is being done and what logfiles are affected.

Configuration commands

Logrotate directives may appear on their own or as part of logfile definitions--instructions for specific logfiles. You may use wildcards to specify those files. Enclose directives for logfile definitions in a beginning and ending curly brace. For example:

compress
/var/log/messages {
rotate 5
weekly
}
compress

Compress old versions of logfiles with gzip.

compresscmd command

Use command to compress logfiles. Default is gzip.

compressext extension

Append filename extension to compressed files instead of the compress command’s default.

compressoptions options

Specify options to pass to the compress command. Default for gzip is −9 for maximum compression.

copy

Copy logfile, but do not change the original.

copytruncate

Copy logfile, then truncate it in place. For use with programs whose logging cannot be temporarily halted.

create [permissions] [owner] [group]

After rotation, re-create logfile with the specified ...

Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.