apache rotate log (windows) 設定

網路與網站相關議題和知識
回覆文章
dtchang
Site Admin
文章: 84
註冊時間: 2017-01-22, 16:54

apache rotate log (windows) 設定

文章 dtchang » 2022-01-05, 23:30

按日將log分檔 (apache24通用)
其中一般的log/error 設定於 httpd.conf 中
而有關ssl 的log 則設定於extra/ httpd_ssl.conf 中
以下示範apache的安裝路徑為 D:/Apache2.2

代碼: 選擇全部

#ErrorLog "logs/error.log"
ErrorLog "|bin/rotatelogs.exe -l D:/Apache2.2/logs/error.%Y.%m.%d.log 86400"
 
#CustomLog "logs/access.log" common
CustomLog "|bin/rotatelogs.exe -l D:/Apache2.2/logs/access.%Y.%m.%d.log 86400" common
 
#TransferLog "D:/Apache2.2/logs/ssl_access.log"
TransferLog "|bin/rotatelogs.exe -l D:/Apache2.2/logs/ssl_access.%Y.%m.%d.log 86400"
 
#CustomLog "D:/Apache2.2/logs/ssl_request.log" \
#          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
CustomLog "|bin/rotatelogs.exe -l D:/Apache2.2/logs/ssl_request.%Y.%m.%d.log 86400" \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
日常不勤於管理,故節約檔案數量,改以用 %m.%d 方式儲存. 而error.log 改用10M計量換檔

代碼: 選擇全部

#ErrorLog "logs/error.log"
ErrorLog "|bin/rotatelogs.exe -l D:/Apache2.2/logs/error.%Y.%m.%d.log 10M"

回覆文章