Код: Выделить всё
# /usr/sbin/logrotate -dv -f /etc/logrotate.d/nginx
reading config file /etc/logrotate.d/nginx
reading config info for /var/log/nginx/access.log
Handling 1 logs
rotating pattern: /var/log/nginx/access.log forced from command line (3 rotations)empty log files are rotated, old logs are removed
considering log /var/log/nginx/access.log
log needs rotating
rotating log /var/log/nginx/access.log, log->rotateCount is 3
renaming /var/log/nginx/access.log.3 to /var/log/nginx/access.log.4 (rotatecount 3, logstart 1, i 3),
renaming /var/log/nginx/access.log.2 to /var/log/nginx/access.log.3 (rotatecount 3, logstart 1, i 2),
renaming /var/log/nginx/access.log.1 to /var/log/nginx/access.log.2 (rotatecount 3, logstart 1, i 1),
renaming /var/log/nginx/access.log.0 to /var/log/nginx/access.log.1 (rotatecount 3, logstart 1, i 0),
renaming /var/log/nginx/access.log to /var/log/nginx/access.log.1
running postrotate script
running script with arg /var/log/nginx/access.log: "
/etc/init.d/nginx logs-reopen
"
removing old log /var/log/nginx/access.log.4
Конфиг /etc/logrotate.d/nginx:
Код: Выделить всё
/var/log/nginx/access.log {
rotate 3
daily
# compress
# missingok
# notifempty
postrotate
/etc/init.d/nginx logs-reopen
endscript
}