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

SA stopped processing #151

Closed PiK2K closed 7 years ago

PiK2K commented 8 years ago

Hi, Few days ago (it might be important - it was end of the month - Sep 30th) SA stopped processing Squid logs. There was no updates, restarts, nothing. Version 6.1 was used. First I updated SA to current v. 6.5 but problem remains. When I start debug mode I get:

SquidAnalyzer version 6.5 Usage: POSIX::strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1) at /usr/share/perl5/SquidAnalyzer.pm line 1669.

It seems like described case #97 but my SquidAnalyzer.pm has corrected rows. Can somebody help what can/should I do to back SA operational? Thanks in advance.

darold commented 8 years ago

Hi,

Please download latest code from github ( wget https://github.com/darold/squidanalyzer/archive/master.zip ) or use git clone. Take care to that the installation override your current one as Perl install directory hav been changed from vendor to site or change it at install time:

export INSTALLDIRS=vendor;
perl Makefile.PL
make && make install

And please post here the content of file /var/www/squidanalyzer/SquidAnalyzer.current

Regards,

PiK2K commented 8 years ago

Hi, Thanks, I did the upgrade with master version provided. The problem remains with the line number change only:

SquidAnalyzer version 6.5 Usage: POSIX::strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1) at /usr/local/share/perl/5.14.2/SquidAnalyzer.pm line 1677.

SquidAnalyzer.current file is still dated on Sep 30th with content:

1475227941475230455.985 36501655

Cheers

darold commented 8 years ago

Please edit file /var/www/squidanalyzer/SquidAnalyzer.current and change fist number 1475227941475230455.985 into 1475230455.985 this migth solves the issue.

PiK2K commented 8 years ago

Thank you very much, it helped. Now I have few days gap - it might be obvious but I never had problems like that - can I easily upload older logs from access.log.*.gz archived files? Thanks again for really fast resolution.

darold commented 8 years ago

If you want to add older log, backup the /var/www/squidanalyzer/SquidAnalyzer.current and detete it. Then process all old files on by one the the older to newer order as follow:

squid-analyzer /var/log/squid/access.log.4.gz
squid-analyzer /var/log/squid/access.log.3.gz
squid-analyzer /var/log/squid/access.log.2.gz
squid-analyzer /var/log/squid/access.log.1

Once all log files are processed override the /var/www/squidanalyzer/SquidAnalyzer.current with the backup.

You may need to perform a rebuild after all: squid-analyzer --rebuild It could takes some time following your statistics history.

Regards,

PiK2K commented 8 years ago

Thanks, I did that:

Usage: POSIX::strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1) at /usr/local/share/perl/5.14.2/SquidAnalyzer.pm line 4773.

"SquidAnalyzer.current" file content: 1475736738.802 7665124

darold commented 8 years ago

Please download and install last development code, commit 3d058e2 might solves this issue. The rerun "squid-analyzer --rebuild"

PiK2K commented 8 years ago

Unfortunately still no luck. I replaced "/usr/share/perl5/SquidAnalyzer.pm" file with new one (233158 bytes) but error remains:

Usage: POSIX::strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1) at /usr/local/share/perl/5.14.2/SquidAnalyzer.pm line 4773.

PiK2K commented 8 years ago

I just realized that I was wrong with "SquidAnalyzer.pm" file path so I replaced it again in proper place "/usr/local/share/perl/5.14.2/SquidAnalyzer.pm" but error is the same.

darold commented 8 years ago

I think it is a backward compatibility issue with old data file on denied stats. Please add the following debug print at line 4769 in /usr/local/share/perl/5.14.2/SquidAnalyzer.pm

print STDERR "ISSUE 151: firsthit value => $denied_stat{$u}{firsthit}\n";

and report here the last debug print before the crash.

PiK2K commented 8 years ago

There you go:

ISSUE 151: firsthit value => 1.47522794147523e+18 Usage: POSIX::strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1) at /usr/local/share/perl/5.14.2/SquidAnalyzer.pm line 4774.

darold commented 8 years ago

It seems that your denied statistics data file are corrupted. Please download and install latest code, commit b07f542 might help to fix the corruption. Run "squid-analyzer --rebuild" and let me know.

PiK2K commented 8 years ago

Never ending story :) I replaced with new "SquidAnalyzer.pm" file (233944 bytes) and new error appeared:

Usage: POSIX::strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1) at /usr/local/share/perl/5.14.2/SquidAnalyzer.pm line 4785.

darold commented 8 years ago

Then last commit 3481b4c add more fix on this issue. Please give a try to last development code again.

PiK2K commented 8 years ago

Hi, there must be some semantic problem in the last version. I get this now:

Bareword found where operator expected at /usr/local/share/perl/5.14.2/SquidAnalyzer.pm line 5243, near "}t1" (Missing operator before t1?) syntax error at /usr/local/share/perl/5.14.2/SquidAnalyzer.pm line 5243, near "}t1 " Global symbol "$t1" requires explicit package name at /usr/local/share/perl/5.14.2/SquidAnalyzer.pm line 5244. Compilation failed in require at /usr/local/bin/squid-analyzer line 6. BEGIN failed--compilation aborted at /usr/local/bin/squid-analyzer line 6.

darold commented 8 years ago

Sorry for this typo, fixed in commit deca496

PiK2K commented 8 years ago

Thank you one more time. System is now operational.

darold commented 8 years ago

Great, good news.