1 頁 (共 1 頁)

apache rotate log (windows) 設定

發表於 : 2022-01-05, 23:30
dtchang
按日將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"