]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
Squid-Accounting: Bugfix & clean up data
authorAlexander Marx <alexander.marx@ipfire.org>
Thu, 17 Dec 2015 10:31:30 +0000 (11:31 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 17 Dec 2015 11:35:53 +0000 (11:35 +0000)
There was a Bug in the addon so that no data was displayed because of a
typo. Additionally the computeraccounts are now filtered out of
trafficdata collection.
Only Proxy/AD/LDAP Accounts and IP adresses are collected.

Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
lfs/squid-accounting
src/squid-accounting/acct.pl

index 2e45c24b2b9b88fa32be08a0c0b2c1124389a1cf..ff78d366031a820f11d5f829f5cbac17e25b2dd6 100644 (file)
@@ -15,7 +15,7 @@ THISAPP    = squid-accounting-$(VER)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 TARGET     = $(DIR_INFO)/$(THISAPP)
 PROG       = squid-accounting
-PAK_VER    = 8
+PAK_VER    = 9
 
 DEPS       = "perl-DBI perl-DBD-SQLite perl-File-ReadBackwards perl-PDF-API2"
 
index 68eb63c75e309102702f48ec7d10d93ed496b175..e90d06ed385d04c8af948a90b09f763c5f54d0a2 100755 (executable)
@@ -100,7 +100,7 @@ if (-f $proxyenabled && $proxylog eq $Lang::tr{'running'}){
        $dbh=&ACCT::connectdb;
        my $m=sprintf("%d",(localtime((time-3600)))[4]+1);
        &ACCT::logger($settings{'LOG'},"month before one hour $m, now is ".($mon+1)."\n");
-       if ($m = ($mon+1) || $m == '12' && ($mon+1) == '1'){
+       if ($m < ($mon+1) || $m == '12' && ($mon+1) == '1'){
                #Logrotate
                my $year1=$year+1900;
                system ("tar", "cfz", "/var/log/accounting-$m-$year1.tar.gz", "/var/log/accounting.log");
@@ -217,6 +217,7 @@ sub fill_db{
        my $tim=time();
        #Fill ACCT table with accounting information
        foreach my $name (sort keys %counter){
+               next if (substr($name,-1,1) eq '$');
                foreach my $bytes (keys %{ $counter{$name} }) {
                        $dbh->do("insert into ACCT (TIME_RUN,NAME,BYTES) values ('$tim','$name','$counter{$name}{$bytes}');");
                }