Linux logrotate command
The Linux logrotate command is used to manage log files.
Using the logrotate command allows you to easily manage the log files generated by the system. It provides automatic rotation, compression, deletion, and mailing of log files. Each log file can be set to be processed daily, weekly, or monthly, and can also be processed immediately when the file becomes too large. You must edit and specify the configuration file yourself. The default configuration file is stored in the /etc directory with the file name logrotate.conf.
Syntax
logrotate [-?dfv][-s <状态文件>][--usage][配置文件]
Parameter Description:
- -? or --help Display help.
- -d or --debug Display the command execution process in detail for troubleshooting or understanding how the program is executed.
- -f or --force Force the log file maintenance operation, even if the logrotate command thinks it is not needed.
- -s<state file> or --state=<state file> Use the specified state file.
- -v or --version Display the command execution process.
- -usage Display the basic usage of the command.
Examples
Specify log files
# logrotate /root/log.configOther Extensions
Linux Command Collection