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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access