Linux logrotate Command
The Linux logrotate command is used to manage log files.
The logrotate command makes it easy to manage log files generated by the system. It provides automatic rotation, compression, removal, and mailing of log files. Each log file can be configured to be handled daily, weekly, or monthly, or immediately when it becomes too large. You must edit the configuration file yourself; the default configuration file is stored in the /etc directory under the name logrotate.conf.
Syntax
logrotate [-?dfv][-s <状态文件>][--usage][配置文件]
Parameter Description:
- -? or --help Online help.
- -d or --debug Display the command execution process in detail, to help with troubleshooting or understanding how the program runs.
- -f or --force Force the start of log file maintenance, even if logrotate considers it unnecessary.
- -s
or --state= Use the specified state file. - -v or --version Display the command execution process.
- -usage Display basic command usage.
Example
Specify the log file
# logrotate /root/log.config
Linux Command Reference