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/
125 stars 36 forks source link

index.html file missing #189

Closed hemak88 closed 5 years ago

hemak88 commented 5 years ago

This is a fresh install of squid proxy loganalyzer on CentOS7 server. I followed steps in install docs, but still index.html file is not created. Below is the steps followed: Download 6.6 version of loganalyzer; unzip; LOGFILE=/var/log/squid/access.log HTMLDIR=/var/www/html/squidreport; make; make install Update httpd conf file as below and restart apache: Alias /squidreport /var/www/html/squidreport <Directory /var/www/html/squidreport> Options +FollowSymLinks +MultiViews -Indexes AllowOverride None Order allow,deny Allow from All Require all granted

Update squidanalyzer conf file as below: Output /var/www/html/squidreport WebUrl /squidreport LogFile /var/log/squid/access.log UseClientDNSName 0 DNSLookupTimeout 0.0001 NetworkAlias /etc/squidanalyzer/network-aliases UserAlias /etc/squidanalyzer/user-aliases OrderNetwork bytes OrderUser bytes OrderUrl bytes OrderMime bytes UrlReport 1 UrlHitsOnly 0 UserReport 1 QuietMode 1 CostPrice 0 Currency € TopNumber 100 TopStorage 0 Exclude /etc/squidanalyzer/excluded Include /etc/squidanalyzer/included DateFormat %y-%m-%d AnonymizeLogin 0 SiblingHit 1 TransfertUnit BYTES MinPie 2 WriteDelay 3600 TopUrlUser 10

I run "/usr/local/bin/squid-analyzer -d" multiple times, but no index.html file generated

darold commented 5 years ago

Can you show the output of the /usr/local/bin/squid-analyzer -d command? There must be an error reported.

hemak88 commented 5 years ago

[root@nklipsqd01 ~]# /usr/local/bin/squid-analyzer -d SquidAnalyzer version 6.6 Starting to parse logfile /var/log/squid/access.log. DEBUG: this file will be parsed, no history found. Reading file /var/log/squid/access.log from offset 0 to end. No new log registered... DEBUG: the log statistics gathering took: 0 wallclock secs ( 0.01 usr + 0.00 sys = 0.01 CPU) Skipping HTML build. DEBUG: generating HTML output took: 0 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU) DEBUG: total execution time: 0 wallclock secs ( 0.01 usr + 0.00 sys = 0.01 CPU)

darold commented 5 years ago

The file /var/log/squid/access.log might be empty or at least SquidAnalyzer doesn't find any well formatted line. Are you using the native or http squid log format? What is the value of logformat in the squid.conf file?

hemak88 commented 5 years ago

access log format from conf file: logformat squid [%tl] %>a %tr %Ss/%03>Hs %Sh/%<a %mt "%rm %ru HTTP/%rv" %>Hs %<st "%{Referer}>h" "%{User-Agent}>h" Sample logs from access.log file: [14/Oct/2018:08:28:22 +0400] 10.64.77.109 721 TCP_MISS/200 FIRSTUP_PARENT/10.64.225.100 text/html "GET http://lnux.com/ HTTP/1.1" 200 4457 "-" "Wget/1.14 (linux-gnu)"

darold commented 5 years ago

According to documentation:

LOGFORMAT
    SquidAnalyzer supports the following predefined log format:

        logformat squid %ts.%03tu %6tr %>a %Ss/%03>Hs %<st %rm %ru %un %Sh/%<A %mt
        logformat common %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %>Hs %<st %Ss:%Sh
        logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %>Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh

    The common and combined log format can have one more field to add
    mime-type report like with the native squid log format:

        logformat common %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %>Hs %<st %Ss:%Sh %mt
        logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %>Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh %mt

unfortunately SquidAnalyzer doesn't support custom format yet. This is a possible feature but this is a major development that need to be sponsored.

hemak88 commented 5 years ago

Yes the default format works. Thanks