nginx logrotate日志回滚
约 79 字
预计阅读 1 分钟
次阅读
logrotate配置
1
2
3
4
5
6
7
8
9
10
11
12
13
|
vi /etc/logrotate.d/nginx
/var/log/nginx/*.log {
rotate 7
size 5k
dateext
dateformat -%Y-%m-%d-%s
missingok
# compress
sharedscripts
postrotate
test -r /run/nginx.pid && kill -USR1 `cat /run/nginx.pid`
endscript
}
|
日志回滚命令
1
2
|
logrotate -v -f /etc/logrotate.d/nginx
|
定时任务
1
2
|
crontab -e
*/5 * * * * /usr/sbin/logrotate -v -f /etc/logrotate.d/nginx
|