LinuxCommandLibrary

logrotate

TLDR

Force rotation manually

$ logrotate [path/to/logrotate.conf] --force
copy
Run with custom mail command
$ logrotate [path/to/logrotate.conf] --mail /usr/bin/mail
copy
Run without state file
$ logrotate [path/to/logrotate.conf] --state /dev/null
copy
Skip state file check
$ logrotate [path/to/logrotate.conf] --skip-state-lock
copy
Log verbose output to file
$ logrotate [path/to/logrotate.conf] --log [path/to/log]
copy

SYNOPSIS

logrotate [options] configfile_

DESCRIPTION

logrotate manages log files by rotating, compressing, removing, and mailing them. It prevents logs from consuming excessive disk space and is typically run daily via cron.

PARAMETERS

-f, --force

Force rotation even if not needed
--mail COMMAND
Command to mail logs
--state FILE
State file path
--skip-state-lock
Skip state file locking
--log FILE
Log verbose output to file
-d, --debug
Debug mode (don't make changes)
-v, --verbose
Verbose output

CAVEATS

Configuration files in /etc/logrotate.d/ are included by the main config. State file tracks rotation history.

SEE ALSO

Copied to clipboard