Apache 2.4 自訂日誌異常

Apache 2.4 自訂日誌異常

我正在嘗試清理我的 apache 日誌,所以我嘗試將 trafic / bot / stats 分成 3 個不同的文件

我使用了文檔:http://httpd.apache.org/docs/2.4/en/logs.html

# [ Logs Exeptions ]
# - Exeption
SetEnvIf Request_URI "\.jpg$|\.jpeg$|\.gif$|\.png$|\.ico|\.icon|\.css$|\.js$|piwik\.php$|frogglogin\.php" dontlog
SetEnvIf User-agent "bot|baidu" dontlog
# - Special rules
SetEnvIf User-agent "bot|baidu" botlog
SetEnvIf Request_URI "piwik\.php$" piwiklog
# - Custom log
CustomLog ${APACHE_LOG_DIR}/bot.log combined env=botlog
CustomLog ${APACHE_LOG_DIR}/piwik.log combined env=piwiklog
# - logs 
CustomLog ${APACHE_LOG_DIR}/access.log combined env=!dontlog

acces.log 是正確的,只有訪問過的文件,但 bot 和 piwik 日誌為空!我嘗試了通用而不是組合,但結果相同......(apache已重新啟動)

有人可以解釋一下我做錯了什麼嗎?

謝謝

答案1

CustomLog 可以在下列上下文中使用:伺服器設定、虛擬主機

所以我需要在標籤中設定 CustomLog 指令

或透過 vhost_combined 更改組合

相關內容