darold / squidanalyzer

Squid Analyzer parses Squid proxy access log and reports general statistics about hits, bytes, users, networks, top URLs, and top second level domains. Statistic reports are oriented toward user and bandwidth control.
http://squidanalyzer.darold.net/
126 stars 36 forks source link

UseClientDNSName not working #116

Closed gitdevmod closed 8 years ago

gitdevmod commented 8 years ago

Hi,

I enabled UseClientDNSName but squid-analyzer does not replace IP to DNS name in reports. When running squid-analyzer I do not see DNS request with tcpdump. /etc/resolv.conf contains local DNS and it works as expected with gethostbyaddr(inet_aton($ip), AF_INET); SquidAnalyzer is installed on FreeBSD with Perl 5.20.3

Thanks in advance

# egrep -v '^#|^$' /usr/local/etc/squidanalyzer.conf
Output  /usr/local/www/squidreport
WebUrl  /squidreport
LogFile /root/log/squid.log,/root/log/block.log
UseClientDNSName        1
DNSLookupTimeout        0.0001
NetworkAlias    /usr/local/etc/network-aliases
UserAlias       /usr/local/etc/user-aliases
OrderNetwork    bytes
OrderUser       bytes
OrderUrl        bytes
OrderMime       bytes
UrlReport       1
UrlHitsOnly     0
UserReport      1
QuietMode       0
CostPrice       0
Currency        €
TopNumber       100
Exclude /usr/local/etc/excluded
Include /usr/local/etc/included
DateFormat      %d-%m-%y
AnonymizeLogin  0
SiblingHit      1
TransfertUnit   MB
MinPie          2
Locale          fr_FR
WriteDelay      3600
TopUrlUser      10
gitdevmod commented 8 years ago

I removed all reports (2015, 2016, SquidAnalyzer.current and SquidGuard.current directory). squid-analayzer has recreated all reports and it did DNS requests (confirmed by tcpdump) but in reports it is still IP instead of hostname.

gitdevmod commented 8 years ago

Problem solved, after adding warn() if ( ($@) && (!$self->{QuietMode})); in _gethostbyaddr sub there is an alarm "DNS lookup timeout." each time, withtout this warn() the alarm was not printed, in squidanalyzer.conf DNSLookupTimeout is 0.0001 which fail even if DNS server is local. It is probably a timing issue with VirualBox guest VM. I raised DNSLookupTimeout to 0.01 and now it works as expected.

darold commented 8 years ago

Thanks for the report. I have added a warning message with commit f206dbd when the timeout is reached.

Best regards,