歡迎您光臨本站 註冊首頁

Apache日誌處理相關匯總

←手機掃碼閱讀     火星人 @ 2014-03-03 , reply:0

Apache日誌處理相關匯總

Apache日誌處理相關匯總


1.日誌分割(請參考)
安裝cronolog
http://bbs.linuxtone.org/thread-93-1-1.html

2.過濾掉無需記錄的日誌
#在httpd.conf 的
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
後面加入如下:    # filter the localhost visit

    SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog

    # filter some special directories

    SetEnvIf Request_URI "^ZendPlatform.*$" dontlog

    SetEnvIf Request_URI \.healthcheck\.html$ dontlog

    SetEnvIf Remote_Addr "::1" dontlog

    SetEnvIf Request_URI "\.getPing.php$" dontlog

    SetEnvIf Request_URI "^/error\.html$" dontlog

    SetEnvIf Request_URI "\.gif$" dontlog

    SetEnvIf Request_URI "\.jpg$" dontlog

    SetEnvIf Request_URI "\.css$" dontlog
複製代碼其它根據自己的需要做一些調整。
另一種日誌不記錄圖片的方法:

SetEnv dontlog 1



CustomLog logs/access_log combined env=!dontlog
複製代碼3.日誌處理
壓縮每天的日誌
30 3 * * * /usr/bin/gzip -f /data/logs/access_www.linuxtone.org.`date -d yesterday +%Y%m%d.log
刪除前三天的日誌
30 5 * * */usr/bin/find /data/logs/ -name access_*.gz  -mtime +3 |xargs -r /bin/rm -f

4.利用awstats分析日誌
http://bbs.linuxtone.org/thread-56-1-1.html
《解決方案》

謝謝分享
《解決方案》

感謝了。正需要

[火星人 ] Apache日誌處理相關匯總已經有809次圍觀

http://coctec.com/docs/service/show-post-1195.html