我看过那个男人 ,但我还不清楚。 我的问题主要与NGINXnetworking服务器日志有关。
这是我目前的logrotate.conf:
# rotate log files weekly weekly # keep 4 weeks worth of backlogs rotate 4 # create new (empty) log files after rotating old ones create # use date as a suffix of the rotated file dateext # uncomment this if you want your log files compressed #compress # RPM packages drop log rotation information into this directory include /etc/logrotate.d # no packages own wtmp and btmp -- we'll rotate them here /var/log/wtmp { monthly create 0664 root utmp minsize 1M rotate 1 } /var/log/btmp { missingok monthly create 0600 root utmp rotate 1 }
并在/etc/logrotate.d我也有其他人之间:nginx:
/var/log/nginx/*log { create 0644 nginx nginx daily rotate 10 missingok notifempty compress sharedscripts postrotate /bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null || true endscript }
这些是.gz我可以看到的一些:
access.log-20150430.gz access.log-20150509.gz (created after ~10 days) access.log-20150524.gz (created after ~15 days) access.log-20150528.gz (created after ~4 days)
我认为logrotate手册很清楚你的大部分观点。 这是我的答案:
daily使用导致日志轮换daily发生。 所以,你需要检查为什么这不是每天都在发生。 例如,如果日志文件为空几天,则可能由其他选项notifempty引起。 monthly和yearly 。 对于尺寸的困惑,你可以使用size 100M 。 daily指定旋转的频率,指定保存的日志文件的数量。