logrotate cut logs

At work, we need to cut the log to select the project system comes with logrotate, other requirements such as the need requires their own look at Baidu or reference:

https://www.cnblogs.com/kevingrace/p/6307298.html

# centos7 cutting 

/data/nginx/logs/access.log { 
    su root root 
    Daily # designated dump cycle per day 
    missingok # If the log is lost, no error log to continue to scroll down a 
    number of dump before deleting the specified log file rotate 360 # 0 means no backup, the backup 360 360 which retain 
    compress # gzip compression by subsequent log dump 
    if delaycompress # and compress when used together, the dump log file to the next dump compression 
    notifempty # when the log file is empty when the rotation is not performed 
    dateext # naming format used as the actual date 
    copytruncate # for the log file is still open, the current log backup and truncation; first copy is then empty the way, there is a time difference between a copy and emptying, may You will lose some log data. 
} 

# Centos6 and Ubuntu 

/data/nginx/logs/access.log { 
   Daily 
   missingok 
   Rotate 360 
   the compress 
   delaycompress 
   dateext
   notifempty
   copytruncate
}

  

Guess you like

Origin www.cnblogs.com/zhaojingyu/p/10949452.html
cut