Why use this tool: when the Apache access log is not scrolling by default, when the access log is too large, the analysis of the log is inconvenient, open may be directly on the wait for 1
Hours!!
Logrotate is a log-cutting tool for most Linux systems, with a configuration file of/etc/logrotate.conf that simply defines an instance of the Apache log cut:
Vim/etc/logrotate.d/apache
How many logs can rotate keep
Notifempty if it's an empty file, don't dump it.
Daily Daily Dump
Missingok if the specified directory does not exist, Logrotate will error, which is used to close the error
A size file is dumped at 50M
Sharedscripts All log files are rotated once the script is executed uniformly
Postrotate/endscript: Commands that need to be executed after the dump can be placed in this pair, these two keywords must be taken separately
Delaycompress: When used with compress, the dump log file is compressed until the next dump
-f/var/run/nginx/nginx.pid confirm that Nginx is started
KILL-USR1 ' Cat/var/run/nginx/nginx.pid ' is not a process that aborts nginx, but is passed to it to generate a signal to regenerate the log
Log Scrolling Tool