calamaris: Make decompressing large logs more memory-friendly.

Thanks to Roger Devaux for reporting and testing.

Calamaris is now able to process big log files consuming about
10M or RAM (was several gigabytes before).
This commit is contained in:
Michael Tremer
2012-07-19 14:06:47 +02:00
parent 7d55ca0da4
commit a786b755eb
2 changed files with 3 additions and 2 deletions

View File

@@ -94,7 +94,7 @@ sub processlogfiles
{
if ($filestr =~ /access\.log/) {
open (LOG,"gzip -dc $filestr |");
foreach (<LOG>) {
while (<LOG>) {
if (substr($_,0,10) >= $date_from) { if (substr($_,0,10) <= $date_to) { print TMPLOG "$_"; } }
}
close(LOG);
@@ -106,7 +106,7 @@ sub processlogfiles
{
if ($filestr =~ /access\.log/) {
open (LOG,$filestr);
foreach (<LOG>) {
while (<LOG>) {
if (substr($_,0,10) >= $date_from) { if (substr($_,0,10) <= $date_to) { print TMPLOG "$_"; } }
}
close(LOG);

View File

@@ -8,5 +8,6 @@ srv/web/ipfire/cgi-bin/ovpnmain.cgi
srv/web/ipfire/cgi-bin/proxy.cgi
var/ipfire/general-functions.pl
var/ipfire/langs
var/ipfire/proxy/calamaris/bin/mkreport
usr/local/bin/getconntracktable
usr/sbin/redirect_wrapper