配置日誌分析: yum install httpd gd -y //安裝http和GD庫 把sarg包拉入 tar xf sarg-2.3.11.tar.gz -C /opt/ //解壓日誌分析軟件包 cd /opt/sarg-2.3.11/ //進入解壓後的文件夾中定義
./configure \ --prefix=/usr/local/sarg \ //指定安裝路徑 --sysconfdir=/etc/sarg \ //配置文件目錄,默認是/usr/local/etc --enable-extraprotection //添加額外的安全保護
make && make install
vi /etc/sarg/sarg.conf //配置
搜索並修改一下內容:
access_log /usr/local/squid/var/logs/access.log //squid的訪問日誌位置htmltitle "Squid User Access Reports" //網頁標題windows
output_dir /var/www/html/squid-reports //分析報告的存放位置瀏覽器
user_ip no //不使用IP代替用戶ID安全
topuser_sort_field BYTES reverse //升序排列ide
user_sort_field BYTES reverse //在top排序中,指定鏈接次數、訪問字節數,採用降序排列,升序將reverse換爲normalui
exclude_hosts /usr/local/sarg/noreport //設置不生成報告的主機日誌
overwrite_report no //當那個日期報告已存在,不覆蓋code
mail_utility mailx //指定發郵件命令orm
charset UTF-8 //使用字符集htm
weekdays 0-6 //指定top排序星期週期
hours 7-12,14,16,18-20 //指定top排序時間週期
www_document_root /var/www/html //網頁根目錄
touch /usr/local/sarg/noreport //創建不生成報告的主機列表文件 ls
ln -s /usr/local/sarg/bin/sarg /usr/local/bin/ //創建軟鏈接,方便環境變量PATH識別 sarg //直接輸
出現如圖,表示正常運行 systemctl start httpd 在windows瀏覽器中輸入 http://192.168.80.100/squid-reports/