SARG (Squid Analysis Report Generator) — генератор аналитических отчётов Squid
apt-get install sarg
По умолчанию создаются задания для Cron в папках:
/etc/cron.monthly/sarg
/etc/cron.weekly/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 header_font_size 9px title_font_size 11px background_color white text_color #000000 text_bgcolor lavender title_color green temporary_dir /tmp output_dir /home/WWW/squid-reports resolve_ip yes user_ip yes topuser_sort_field BYTES reverse user_sort_field BYTES reverse exclude_users /etc/sarg/exclude_users exclude_hosts /etc/sarg/exclude_hosts date_format u lastlog 365 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/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/sarg/usertab
SARG=/usr/bin/sarg CONFIG=/etc/sarg/sarg.conf HTMLOUT=/home/WWW/squid-reports PAGETITLE="Access Reports on $(hostname)" LOGOIMG=/squid-reports/images/sarg.png LOGOLINK="http://$(hostname)/squid-reports" DAILY=Daily WEEKLY=Weekly MONTHLY=Monthly EXCLUDELOG1="SARG: No records found" EXCLUDELOG2="SARG: End"
1. Нужно создать файл:
Alias /squid-reports /home/WWW/squid-reports <VirtualHost *:80> ServerName sarg.domain.local ServerAlias sarg ServerAdmin admin@domain.ru DocumentRoot /var/www/html/squid-reports </VirtualHost> <Directory /var/www/html/squid-reports > Options +FollowSymLinks AllowOverride All Order Deny,Allow Deny from all Allow from localhost 127.0.0.1 ::1 Allow from 192.168.0.0/16 Allow from 10.0.0.0/8 </Directory>
2. Выполнить следующие действия:
# Создаем символическую ссылку ln -s /etc/sarg/apache.conf /etc/apache2/sites-available/sarg.conf # Разрешаем сайт a2ensite sarg # Перезапуск service apache2 reload