Dica para não esquecer, basta apenas tem uma breve noção do funcionamento do squid e apache httpd.
Fiz instalação pelo ports FreeBSD 8.2 .
# cd /usr/ports/www/sarg && make install clean
Editando o conf:
# cat /usr/local/etc/sarg/sarg.conf
#############Begin
access_log /var/log/squid/access.log
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 /usr/local/www/data/sarg/
resolve_ip
user_ip no
topuser_sort_field BYTES reverse
user_sort_field BYTES reverse
exclude_users /usr/local/etc/sarg/sarg.users
exclude_hosts /usr/local/etc/sarg/sarg.hosts
date_format u
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 /usr/local/etc/sarg/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 /usr/local/etc/sarg/sarg.usertab
long_url no
date_time_by bytes
charset Latin1
show_successful_message no
show_read_statistics no
topuser_fields NUM DATE_TIME USERID COcNNECT 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
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,mpeg"
###########EOF
Crie os arquivos necessários para a execução:
# touch /usr/local/etc/sarg/sarg.usertab
# touch /usr/local/etc/sarg/sarg.hosts
# touch /usr/local/etc/sarg/sarg.users
# touch /usr/local/etc/sarg/sarg.exclude_codes
# mkdir /usr/local/www/data/sarg
Criando um script para execução:
# vim /etc/scripts/sarg-dia.sh
#############Begin
#!/usr/local/bin/bash
data=$(date "+%d/%m/%Y")
/usr/local/bin/sarg -f /usr/local/etc/sarg/sarg.conf -d $data-$data
#############EOF
Dê permissões
# chmod +x /etc/scripts/sarg-dia.sh
No meu caso, ocorreu um erro de permissões no binário do sarg e eu contornei assim:
# chmod u+gx /usr/local/bin/sarg
Execute:
# sh /etc/scripts/sarg-dia.sh
Adicione na crontab:
45 00 * * * sh /etc/scripts/sarg-dia.sh
E um abraço.
OBS: Se trocar os caminhos das conf, funciona com Linux .