darold/squidanalyzer

Error parsing squidguard logs

silvaguilherme opened this issue · 3 comments

I am having errors when logging squidguard logs.
TOP Denied is always with REDIRECT.
I tried the issue # 164 solution, but then make the change, I get this error when I try to generate the report.
squidanalyzer

I can not reproduce this issue. Please use latest development code and report the error reported. If you can post a sample log file it will help too.

I have a similar problem with the current git code.
Some times ago the code changed, e.g. in the 'check_exlusions()' sub:
from:
foreach my $e (@{$self->{Exclude}{uris}}) { if ($url =~ m#^$e$#i) { return 1;}
to:
return 1 if (grep(/^$url$/i, @{ $self->{UrlExcludeCache} }));

With the 'new' code, if the logged url contains some regex special character, the grep may fail like above:
I have a malformed url in access.log:
1551045792.016 201 10.1.60.11 TCP_MISS/301 447 GET http://toprumbudapest.com/wp-content/themes/to
prum/img/logo.svg') - HIER_DIRECT/67.207.72.37 text/html

Please note the ') at the end of the url.

So, the new code just fail with:
Unmatched ) in regex; marked by <-- HERE in m/^http://toprumbudapest.com/wp-content/themes/toprum/img/logo.svg') <-- HERE $/ at /usr/local/share/perl/5.20.2/SquidAnalyzer.pm line 1098, line 142976.

Hi,

Thanks for the detailed report. Commit 842ade0 might solve this issue, give a try to latest development code and let me know if there is any other issues.

Regards,