Linux logrotate Command
The Linux logrotate command is used to manage log files.
Using the logrotate command, you can 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 if the file becomes too large. You must manually edit and specify the configuration file. The default configuration file is located in the /etc directory with the name logrotate.conf.
Syntax
logrotate [-?dfv][-s <state file>][--usage][configuration file]
Parameter Description:
-? or --help: Online help.
-d or --debug: Display detailed execution process, useful for troubleshooting or understanding program execution.
-f or --force: Force the log file maintenance operation to start, even if the logrotate command does not think it is necessary.
-s <state file> or --state=<state file>: Use the specified state file.
-v or --version: Display the execution process of the command.
--usage: Display the basic usage of the command.
Example
Specify log file
# logrotate /root/log.config