Logrotate的常见配置
缩小日志大小和备份文件用
如果想测试配置文件
/usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf
下面是nginx php和mysql的日志设置
/var/log/nginx/*.log { daily size 1G missingok rotate 10 compress delaycompress notifempty create 0640 nobody nobody sharedscripts prerotate if [ -d /etc/logrotate.d/httpd-prerotate ]; then run-parts /etc/logrotate.d/httpd-prerotate; fi endscript postrotate [ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid` endscript } /usr/local/php/var/log/php-fpm.log /usr/local/php/var/log/php-fpm.log.slow { dateext create #maxage 90 rotate 60 missingok sharedscripts postrotate /bin/kill -USR1 `cat /var/run/php-fpm.pid` endscript } /var/lib/mysql/slow-log /var/lib/mysql/localhost.err { dateext create # notifempty #maxage 90 rotate 60 missingok sharedscripts postrotate /usr/local/mysql/bin/mysqladmin -uroot -p'password' flush-logs endscript }
原文出处:phpgao -> https://blog.phpgao.com/logrotate_conf.html
本站所发布的一切资源仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如果侵犯你的利益,请发送邮箱到 [email protected],我们会很快的为您处理。