sarg是以網頁的形勢來展示squid緩存結果的一種工具
wget http://www.sfr-fresh.com/unix/privat/sarg-2.2.7.1.tar.gz
一,安裝
二,配置
cd /usr/local/sarg/etc
下面有一個sarg.conf檔案,這個檔案是配置大全,不過全被注釋掉了。是以這個檔案我不需要,當作備份。
mv sarg.conf sarg.confbak
vi sarg.conf
把下面的内容考進去,是我機子裡面的sarg配置
language English #英文版
access_log /usr/local/squid/var/logs/access.log #squid安裝時,access_log的所在
font_face Verdana,Arial #字型設定,因為這個管理工具是網頁的形勢存在的
header_color darkblue #設header的顔色
font_size 12px #設定字型大小
password none #不要設密碼
title "Squid report" #設定标題
output_dir /home/zhangy/www/sarg #生成後的html存放到那裡,設定到你的網站目錄下,/home/zhangy/www是網站的根目錄
overwrite_report yes #是否覆寫報告,當那個日期的報告已經存在時是否覆寫掉
mail_utility mail #以mail方式來發郵件
exclude_hosts /usr/local/sarg/etc/exclude_hosts #不充許的hosts
topsites_num 100 #最多可以顯示多少個網站
exclude_codes /usr/local/sarg/etc/exclude_codes
max_elapsed 28800000 #設定過時時間
charset utf8 #設定編碼
三,測試
配置好了以後
[root@BlackGhost bin]# ./sarg
SARG: Records in file: 120, reading: 100.00%
SARG: Successful report generated on /home/zhangy/www/sarg/2010Jun13-2010Jun13
有了這個則表示,sarg才真正的安裝配置好了。
參數如下
./sarg -h
./sarg: usage [options...]
-a hostname or ip address 指定不計入排序的主機名稱或位址
-b useragent log 使用者代理日志檔案輸出
-c exclude file 指定不計入排序的站點清單檔案名為/usr/local/sarg/norecords,對于用戶端通路的這些站點,将不會被top排序中
-d date from-until dd/mm/yyyy-dd/mm/yyyy 指定日期範圍
-e email address to send reports (stdout for console) 指定報告接收者郵件
-f config file (/usr/local/sarg/sarg.conf) 指定配置檔案
-g date format [e=europe -> dd/mm/yy, u=usa -> mm/dd/yy] 指定輸入的日期格式
-h help (this…) 列幫助資訊
-i reports by user and ip address 指定用戶端排序采用使用者名或者ip位址
-l input log 指定squid日志檔案絕對路徑。
-o output dir 指定網頁報告檔案輸出路徑,推薦使用webmaster或其他非admin使用者運作sarg。
-p use ip address instead userid (reports) 使用ip位址作為userid域
-w temporary dir 指定臨時檔案目錄,請确認該目錄所在的分區足夠大先,1g以上。
http://localhost/sarg/2010Jun13-2010Jun13/127.0.0.1/127.0.0.1.html内容如下

squid緩存報告
squid安裝配置的博文http://blog.51yip.com/server/638.html,本文sarg所報告的就是638這篇博文裡所安裝squid所産生的資料。