“rotatelogs”的版本间的差异
来自个人维基
小 |
|||
第1行: | 第1行: | ||
− | + | /etc/logrotate.d/apache2 | |
<pre> | <pre> | ||
/var/log/apache2/*.log { | /var/log/apache2/*.log { |
2025年4月15日 (二) 12:07的最后版本
/etc/logrotate.d/apache2
/var/log/apache2/*.log { daily size 100M missingok rotate 10 compress delaycompress notifempty create 640 root adm sharedscripts postrotate /etc/init.d/apache2 reload > /dev/null endscript prerotate if [ -d /etc/logrotate.d/httpd-prerotate ]; then \ run-parts /etc/logrotate.d/httpd-prerotate; \ fi; \ endscript }
=>size 改用 maxsize & minsize
/var/log/apache2/*.log { daily maxsize 10M minsize 1M missingok rotate 10 compress delaycompress notifempty create 640 root adm sharedscripts postrotate /etc/init.d/apache2 reload > /dev/null endscript prerotate if [ -d /etc/logrotate.d/httpd-prerotate ]; then \ run-parts /etc/logrotate.d/httpd-prerotate; \ fi; \ endscript }
=>
/var/log/apache2/*.log { size 10M missingok rotate 10 compress delaycompress notifempty create 640 root adm sharedscripts postrotate /etc/init.d/apache2 reload > /dev/null endscript prerotate if [ -d /etc/logrotate.d/httpd-prerotate ]; then \ run-parts /etc/logrotate.d/httpd-prerotate; \ fi; \ endscript }
参考:https://blog.csdn.net/sinat_36358653/article/details/107390349