Merge branch 'master' of github.com:darold/squidanalyzer

This commit is contained in:
Gilles Darold 2020-11-06 08:00:07 +01:00
commit 43ba618e01
4 changed files with 57 additions and 33 deletions

41
README
View File

@ -127,21 +127,32 @@ INSTALLATION
If your squid logfiles are rotated then cron isn't going to give the
expected result as there exists a time between when the cron is run and
the logfiles are rotated. It would be better to call squid-analyzer from
logrotate, eg:
logrotate, create file /etc/logrotate.d/squid with the following
content:
/var/log/proxy/squid-access.log {
daily
compress
rotate 730
missingok
nocreate
sharedscripts
postrotate
test ! -e /var/run/squid.pid || /usr/sbin/squid -k rotate
/usr/bin/squid-analyzer -d -l /var/log/proxy/squid-access.log.1
endscript
/var/log/squid/*.log {
daily
compress
delaycompress
rotate 5
missingok
nocreate
sharedscripts
postrotate
test ! -e /var/run/squid.pid || test ! -x /usr/sbin/squid || /usr/sbin/squid -k rotate
/usr/local/bin/squid-analyzer -d -l /var/log/squid/access.log.1
endscript
}
Be sure that the paths used in this script correspond to your system.
5. Adjust the configuration
Make sure that the LogFile path is correct in your squidanalyzer.conf
file. For instance:
LogFile /var/log/squid/access.log
You can also use network name instead of network ip addresses by using
the network-aliases file. Also if you don't have authentication enable
and want to replace client ip addresses by some know user or computer
@ -319,11 +330,11 @@ CONFIGURATION
DNS name instead. Note that you must have a working DNS resolution
and that it can really slow down the generation of reports.
DNSLookupTimeout 0.0001
DNSLookupTimeout 100
If you have enabled UseClientDNSName and have lot of ip addresses
that do not resolve you may want to increase the DNS lookup timeout.
By default SquidAnalyzer will stop to lookup a DNS name after 0.0001
second (100 ms).
By default SquidAnalyzer will stop to lookup a DNS name after 100
ms. The value must be set in millisecond.
StoreUserIp 0
Store and show user different ip addresses used along the time in

View File

@ -1630,8 +1630,8 @@ sub _init
$self->{with_month_stat} = 0;
$self->{no_week_stat} = 0;
$self->{UseClientDNSName} = $options{UseClientDNSName} || 0;
$self->{DNSLookupTimeout} = $options{DNSLookupTimeout} || 0.0001;
$self->{DNSLookupTimeout} = int($self->{DNSLookupTimeout} * 1000000);
$self->{DNSLookupTimeout} = $options{DNSLookupTimeout} || 100;
$self->{DNSLookupTimeout} = int($self->{DNSLookupTimeout} * 1000);
$self->{LogFile} = ();
$self->{queue_size} = 1;
$self->{running_pids} = ();

View File

@ -130,21 +130,32 @@ or run it manually. For more information, see README file.
If your squid logfiles are rotated then cron isn't going to give the expected
result as there exists a time between when the cron is run and the logfiles
are rotated. It would be better to call squid-analyzer from logrotate, eg:
are rotated. It would be better to call squid-analyzer from logrotate, create
file /etc/logrotate.d/squid with the following content:
/var/log/proxy/squid-access.log {
daily
compress
rotate 730
missingok
nocreate
sharedscripts
postrotate
test ! -e /var/run/squid.pid || /usr/sbin/squid -k rotate
/usr/bin/squid-analyzer -d -l /var/log/proxy/squid-access.log.1
endscript
/var/log/squid/*.log {
daily
compress
delaycompress
rotate 5
missingok
nocreate
sharedscripts
postrotate
test ! -e /var/run/squid.pid || test ! -x /usr/sbin/squid || /usr/sbin/squid -k rotate
/usr/local/bin/squid-analyzer -d -l /var/log/squid/access.log.1
endscript
}
Be sure that the paths used in this script correspond to your system.
5. Adjust the configuration
Make sure that the LogFile path is correct in your squidanalyzer.conf file.
For instance:
LogFile /var/log/squid/access.log
You can also use network name instead of network ip addresses by using the
network-aliases file. Also if you don't have authentication enable and
want to replace client ip addresses by some know user or computer you
@ -329,11 +340,12 @@ the client ip address, this allow you to use the DNS name instead.
Note that you must have a working DNS resolution and that it can really slow
down the generation of reports.
=item DNSLookupTimeout 0.0001
=item DNSLookupTimeout 100
If you have enabled UseClientDNSName and have lot of ip addresses that do not
resolve you may want to increase the DNS lookup timeout. By default
SquidAnalyzer will stop to lookup a DNS name after 0.0001 second (100 ms).
SquidAnalyzer will stop to lookup a DNS name after 100 ms. The value must
be set in millisecond.
=item StoreUserIp 0

View File

@ -22,8 +22,9 @@ UseClientDNSName 0
# If you have enabled UseClientDNSName and have lot of ip addresses that do
# not resolve you may want to increase the DNS lookup timeout. By default
# SquidAnalyzer will stop to lookup a DNS name after 0.0001 second (100 ms).
DNSLookupTimeout 0.0001
# SquidAnalyzer will stop to lookup a DNS name after 100 ms. The value must
# be set in millisecond.
DNSLookupTimeout 100
# Set the file containing network alias name. Network are
# show as Ip addresses so if you want to display name instead