edumuitoloco
(usa CentOS)
Enviado em 01/11/2011 - 10:32h
MEU SARG:
access_log /var/log/squid/access.log
title "Relatorios do TI"
graphs yes
graph_days_bytes_bar_color orange
logo_image none
topuser_sort_field BYTES reverse
user_sort_field BYTES reverse
date_format e
lastlog 60
remove_temp_files yes
index yes
overwrite_report yes
exclude_codes /etc/sarg/exclude_codes
topsites_num 200
topsites_sort_order CONNECT D
index_sort_order D
max_elapsed 0
report_type topusers topsites sites_users users_sites date_time denied auth_failures site_user_time_date downloads
long_url no
date_time_by bytes
displayed_values abbreviation
temporary_dir /tmp
graph_font /usr/share/fonts/dejavu-lgc/DejaVuLGCSans.ttf
usertab /etc/squid/sarg.usertab
SCRIPT DIARIO
#!/bin/bash
YESTERDAY=$(date --date "1 day ago" +%d/%m/%Y)
sarg -o /var/www/html/relatorios/diario -d $YESTERDAY > /dev/null 2>&1
exit 0
SCRIPT MENSAL
#!/bin/bash
YESTERDAY=$(date --date "1 day ago" +%d/%m/%Y)
MONTHAGO=$(date --date "1 month ago" +%d/%m/%Y)
cat /var/log/squid/access.log.2 /var/log/squid/access.log.1 /var/log/squid/access.log.0 /var/log/squid/access.log > /var/log/squid/access.log.month
/usr/bin/sarg -l /var/log/squid/access.log.month -o /var/www/html/relatorios/mensal -d $MONTHAGO-$YESTERDAY
# > /dev/null 2>&1
#Abilite a linha abaixo se quiser zerar o log
#/usr/sbin/squid -k rotate
rm -rf /var/log/squid/access.log.month
exit 0
SCRIPT SEMANAL
#!/bin/bash
cat /var/log/squid/access.log.0 /var/log/squid/access.log > /var/log/squid/access.log.week
YESTERDAY=$(date --date "1 days ago" +%d/%m/%Y)
WEEKAGO=$(date --date "7 days ago" +%d/%m/%Y)
/usr/bin/sarg -l /var/log/squid/access.log.week -o /var/www/html/relatorios/semanal -d $WEEKAGO-$YESTERDAY > /dev/null 2>&1
rm -rf /var/log/squid/access.log.week
exit 0
MEU SQUID.CONF
hierarchy_stoplist cgi-bin ?OC
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
http_port 8654
visible_hostname firewall.localdomain
cache_mem 64 MB
cache_dir ufs /var/spool/squid 5000 16 1024
dns_nameservers 8.8.8.8
dns_nameservers 8.8.4.4
access_log /var/log/squid/access.log squid
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
hierarchy_stoplist cgi-bin ?
auth_param basic program /usr/lib/squid/pam_auth
auth_param basic children 5
auth_param basic realm firewall
auth_param basic credentialsttl 2 hours
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl Safe_ports port 53 # DNS
acl Safe_ports port 8001 # REDFACTOR
acl Safe_ports port 1863 # MSN
acl CONNECT method CONNECT
acl password proxy_auth REQUIRED
acl url_bom dstdomain "/admin/squid/urlbom"
acl url_quente dstdomain "/admin/squid/urlquente"
acl site_quente url_regex "/admin/squid/sitequente"
acl palavra_quente url_regex "/admin/squid/palavraquente"
acl extensoes url_regex "/admin/squid/extensoes"
acl firstrunIE_EML src 10.0.0.0/24
acl url_firstrunIE_EML url_regex "/admin/squid/firstrunIE_url_EML"
acl usuario_msn proxy_auth "/admin/squid/msnusersEML"
acl url_msn_EML url_regex "/admin/squid/msn_urls_EML"
acl msn urlpath_regex -i ADSAdClient31.dll?
acl msn1 req_mime_type -i ^application/x-msn-messenger$
acl msn2 urlpath_regex -i gateway/gateway.dll?
http_access allow usuario_msn msn
http_access deny !usuario_msn msn
http_access allow usuario_msn msn1
http_access deny !usuario_msn msn1
http_access allow usuario_msn msn2
http_access deny !usuario_msn msn2
http_access allow usuario_msn url_msn_EML
http_access deny !usuario_msn url_msn_EML
http_access allow manager localhost
http_access deny manager
http_access allow firstrunIE_EML url_firstrunIE_EML
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access deny palavra_quente !url_bom
http_access deny site_quente !url_bom
http_access deny url_quente !url_bom
http_access deny extensoes
http_access allow password
http_access allow localhost
http_access deny all
logfile_rotate 5
httpd_suppress_version_string on
cache_log /var/log/squid/cache.log
Pronto! Tudo aí! Qualquer ajuda é muito bem vinda!
Muito obrigado!