apache 2.4.4 自動分割日誌,按年月日生成
阿新 • • 發佈:2019-01-27
<VirtualHost *:80> #風來了.呆狐狸 DocumentRoot "/www/wwwroot/www.lanmps.com" ServerName www.lanmps.com DirectoryIndex index.html index.php index.htm ErrorLog "/www/wwwLogs/logs/www.lanmps.com/_error.error_log" CustomLog "|/www/lanmps/apache/bin/rotatelogs /www/wwwLogs/logs/www.lanmps.com/%Y_%m_%d.access.log 86400" common <Directory /www/wwwroot/www.lanmps.com> Options -Indexes AllowOverride All Require all granted </Directory> </VirtualHost>
如果限制日誌檔案大小800M,超過該大小自動切割檔案,可以如下設定
CustomLog "|/www/lanmps/apache/bin/rotatelogs /www/wwwLogs/logs/www.lanmps.com/%Y_%m_%d.access.log 86400 800M" common
關於apache rotatelogs 函式詳解請看http://88fly.blog.163.com/blog/static/122680390201293172154395/