обработка_лог_файлов_сервера_squid

Обработка лог файлов сервера SQUID

Использование пакета SARG

Ubuntu

Установка, настройка

root@gate:~# apt install sarg

root@gate:~# cat /etc/sarg/sarg.conf
...
access_log /var/log/squid/access.log
...
root@gate:~# cat /etc/sarg/sarg-reports.conf
...
HTMLOUT=/var/www/html/sarg
...

Автоматизация процесса построения отчета

root@gate:~# less /etc/cron.daily/sarg

root@gate:~# less /etc/logrotate.d/squid

Построения отчета в ручном режиме

root@gate:~# /usr/sbin/sarg-reports manual 07/02/2014

root@gate:~# /usr/sbin/sarg-reports today

FreeBSD

Установка, настройка

[gate:~] # pkg install sarg

[gate:~] # pkg_add -r sarg
 
[gate:~] # cd /usr/local/etc/sarg/

[gate:local/etc/sarg] # cat sarg.conf
...
access_log /var/log/squid/access.log.0
...
output_dir /usr/local/www/apache24/data/sarg
...
charset Koi8-r
...
[gate:~] # squid -k rotate

[gate:~] # setenv LANG ru_RU.KOI8-R

[gate:~] # sarg

Автоматизация процесса построения отчета

на постоянно работающем сервере:

[gate:~] # cat /usr/local/etc/periodic/daily/100.sarg.sh
#!/bin/sh
echo Generate Squid Access Report
/usr/bin/find /usr/local/www/data/sarg/ -maxdepth 1 -mtime +60 -type d -name '*-*' -exec rm -r {} \;
/usr/local/sbin/squid -k rotate
export LANG=ru_RU.KOI8-R
/usr/local/bin/sarg
[gate:~] # chmod +x /usr/local/etc/periodic/daily/100.sarg.sh 

на сервере работающем в течении рабочего дня:

[gate:~] # cat /usr/local/etc/rc.d/sarg.sh
#!/bin/sh
echo Generate Squid Access Report
/usr/bin/find /usr/local/www/data/sarg/ -maxdepth 1 -mtime +60 -type d -name '*-*' -delete
/usr/local/sbin/squid -k rotate
export LANG=ru_RU.KOI8-R
/usr/local/bin/sarg
[gate:~] # chmod +x /usr/local/etc/rc.d/sarg.sh 
обработка_лог_файлов_сервера_squid.txt · Last modified: 2020/09/02 08:28 by val