This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
обработка_лог_файлов_сервера_squid [2011/11/30 10:52] 127.0.0.1 внешнее изменение |
обработка_лог_файлов_сервера_squid [2017/05/05 06:49] val [Ubuntu] |
||
---|---|---|---|
Line 7: | Line 7: | ||
=== Установка, настройка === | === Установка, настройка === | ||
<code> | <code> | ||
+ | [gate:~] # pkg install sarg | ||
+ | |||
[gate:~] # pkg_add -r sarg | [gate:~] # pkg_add -r sarg | ||
[gate:~] # cd /usr/local/etc/sarg/ | [gate:~] # cd /usr/local/etc/sarg/ | ||
- | |||
- | [gate:local/etc/sarg] # cp sarg.conf.default sarg.conf | ||
[gate:local/etc/sarg] # cat sarg.conf | [gate:local/etc/sarg] # cat sarg.conf | ||
+ | </code><code> | ||
... | ... | ||
- | access_log /var/squid/logs/access.log.0 | + | access_log /var/log/squid/access.log.0 |
... | ... | ||
- | output_dir /usr/local/www/apache22/data/squid-reports | + | output_dir /usr/local/www/apache24/data/sarg |
... | ... | ||
+ | charset Koi8-r | ||
+ | ... | ||
+ | </code><code> | ||
[gate:~] # squid -k rotate | [gate:~] # squid -k rotate | ||
+ | |||
+ | [gate:~] # setenv LANG ru_RU.KOI8-R | ||
[gate:~] # sarg | [gate:~] # sarg | ||
- | SARG: Records in file: 23, reading: 0.00% | ||
- | SARG: Successful report generated on /usr/local/www/data/squid-reports/2006Jun28-2006Jun28 | ||
</code> | </code> | ||
Line 32: | Line 35: | ||
<code> | <code> | ||
[gate:~] # cat /usr/local/etc/periodic/daily/100.sarg.sh | [gate:~] # cat /usr/local/etc/periodic/daily/100.sarg.sh | ||
+ | </code><code> | ||
#!/bin/sh | #!/bin/sh | ||
echo Generate Squid Access Report | echo Generate Squid Access Report | ||
- | /usr/bin/find /usr/local/www/data/squid-reports/ -maxdepth 1 -mtime +60 -type d -name '*-*' -exec rm -r {} \; | + | /usr/bin/find /usr/local/www/data/sarg/ -maxdepth 1 -mtime +60 -type d -name '*-*' -exec rm -r {} \; |
/usr/local/sbin/squid -k rotate | /usr/local/sbin/squid -k rotate | ||
+ | export LANG=ru_RU.KOI8-R | ||
/usr/local/bin/sarg | /usr/local/bin/sarg | ||
+ | </code><code> | ||
[gate:~] # chmod +x /usr/local/etc/periodic/daily/100.sarg.sh | [gate:~] # chmod +x /usr/local/etc/periodic/daily/100.sarg.sh | ||
</code> | </code> | ||
Line 44: | Line 49: | ||
<code> | <code> | ||
[gate:~] # cat /usr/local/etc/rc.d/sarg.sh | [gate:~] # cat /usr/local/etc/rc.d/sarg.sh | ||
+ | </code><code> | ||
#!/bin/sh | #!/bin/sh | ||
echo Generate Squid Access Report | echo Generate Squid Access Report | ||
- | /usr/bin/find /usr/local/www/data/squid-reports/ -maxdepth 1 -mtime +60 -type d -name '*-*' -delete | + | /usr/bin/find /usr/local/www/data/sarg/ -maxdepth 1 -mtime +60 -type d -name '*-*' -delete |
/usr/local/sbin/squid -k rotate | /usr/local/sbin/squid -k rotate | ||
+ | export LANG=ru_RU.KOI8-R | ||
/usr/local/bin/sarg | /usr/local/bin/sarg | ||
+ | </code><code> | ||
[gate:~] # chmod +x /usr/local/etc/rc.d/sarg.sh | [gate:~] # chmod +x /usr/local/etc/rc.d/sarg.sh | ||
</code> | </code> | ||
- | |||
==== Ubuntu ==== | ==== Ubuntu ==== | ||
+ | |||
+ | === Установка, настройка === | ||
+ | <code> | ||
+ | root@gate:~# apt install sarg | ||
+ | |||
+ | root@gate:~# cat /etc/sarg/sarg.conf | ||
+ | </code><code> | ||
+ | ... | ||
+ | access_log /var/log/squid/access.log | ||
+ | ... | ||
+ | </code><code> | ||
+ | root@gate:~# cat /etc/sarg/sarg-reports.conf | ||
+ | </code><code> | ||
+ | ... | ||
+ | HTMLOUT=/var/www/html/sarg | ||
+ | ... | ||
+ | </code> | ||
+ | |||
+ | === Автоматизация процесса построения отчета === | ||
+ | <code> | ||
+ | root@gate:~# less /etc/cron.daily/sarg | ||
+ | |||
+ | root@gate:~# less /etc/logrotate.d/squid | ||
+ | </code> | ||
+ | |||
+ | === Построения отчета в ручном режиме === | ||
<code> | <code> | ||
- | root@gate:~# apt-get install sarg | + | root@gate:~# /usr/sbin/sarg-reports manual 07/02/2014 |
- | root@gate:~# /etc/cron.daily/sarg | + | root@gate:~# /usr/sbin/sarg-reports today |
- | Результаты на следующий день | + | |
</code> | </code> | ||
- | Проверка: | ||
- | Наберите в MSIE http://gate.corpX.un/squid-reports/ | ||