Linux系统的日志文件的切分主要是由logrotate来完成的,以centos7为例配置通常在/etc/logrotate.d 目录下
添加 nginx 文件
cat nginx
/var/log/nginx/*.log { daily missingok rotate 52 compress delaycompress notifempty create 640 root root sharedscripts postrotate # [ -f /var/run/nginx.pid ] && kill -USR1 `cat /var/run/nginx.pid` docker inspect -f '{{ .State.Pid }}' nginx | xargs kill -USR1 endscript }