如何在Debian下安装调试Squid Analysis Report Generator (SARG)

本文将介绍如何在Debian或其他Linux版本下安装调试SARG。

SARG代表Squid Analysis Report Generator,是一款能够生成图形界面流量报告的免费软件。

在Ubuntu下你可以通过以下命令得以安装:

apt-get install sarg

但是在debian下你需要首先修改source.list然后进行下载,完全步骤如下:

1. 打开/etc/apt/source.list

2. 添加以下命令行到source.list:

deb http://backports.debian.org/debian-backports squeeze-backports mail

3. 更新list:apt-get update

4. 下载并安装SARG:apt-get install sarg

安装后调试/etc/sarg/sarg.conf ,将文件调试成以下:

黑体标示的地方需要注意,要根据本地服务器设置进行修改
access_log /var/log/squid3/access.log
graphs yes
graph_days_bytes_bar_color orange
title “Squid User Access Reports”
font_face Tahoma,Verdana,Arial
header_color darkblue
header_bgcolor blanchedalmond
font_size 9px
background_color white
text_color #000000
text_bgcolor lavender
title_color green
temporary_dir /tmp
output_dir /var/www/squid-reports
resolve_ip
user_ip no
topuser_sort_field BYTES reverse
user_sort_field BYTES reverse
exclude_users /etc/squid3/sarg_users
exclude_hosts /etc/squid3/sarg_hosts
date_format e
lastlog 0
remove_temp_files yes
index yes
index_tree file
overwrite_report yes
records_without_userid ip
use_comma yes
mail_utility mailx
topsites_num 100
topsites_sort_order CONNECT D
index_sort_order D
exclude_codes /etc/squid3/sarg.exclude_codes
max_elapsed 28800000
report_type topusers topsites sites_users users_sites date_time denied auth_failures site_user_time_date downloads
usertab /etc/squid3/sarg.usertab
long_url no
date_time_by bytes
charset Latin1
show_successful_message yes
show_read_statistics yes
topuser_fields NUM DATE_TIME USERID CONNECT BYTES %BYTES IN-CACHE-OUT USED_TIME MILISEC %TIME TOTAL AVERAGE
user_report_fields CONNECT BYTES %BYTES IN-CACHE-OUT USED_TIME MILISEC %TIME TOTAL AVERAGE
topuser_num 0
site_user_time_date_type table
download_suffix “zip,arj,bzip,gz,ace,doc,iso,adt,bin,cab,com,dot,drv$,lha,lzh,mdb,mso,ppt,rtf,src,shs,sys,exe,dll,mp3,avi,mpg,m

5. 如果没有安装apache2,需要安装apache2

apt-get install apache2

6. 都完成后,通过 http://ip-address/squid-reports/ 来访问

7. 调试exclude_users和exclude_hosts设定规则