Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > General

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 18th November 2012, 22:56
TKoos TKoos is offline
Junior Member
 
Join Date: Nov 2012
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Webalizer lags two days

Hi,

I've a problem with Webalizer. The cron runs every night at 00:30. AFAIK that should mean that the current /stats always would include the day before.

Mine does not. :-/ Today is 18 of nov. The stats however only counts up to the 16:th.

Am I wrong, is this the expected behaviour?


This is the webalizer part of cron_daily.php:

Code:
#######################################################################################################
// Create webalizer statistics
#######################################################################################################

function setConfigVar( $filename, $varName, $varValue ) {
        if($lines = @file($filename)) {
                $out = '';
                $found = 0;
                foreach($lines as $line) {
                        @list($key, $value) = preg_split('/[\t= ]+/', $line, 2);
                        if($key == $varName) {
                                $out .= $varName.' '.$varValue."\n";
                                $found = 1;
                        } else {
                                $out .= $line;
                        }
                }
                if($found == 0) {
                        //* add \n if the last line does not end with \n or \r
                        if(substr($out,-1) != "\n" && substr($out,-1) != "\r") $out .= "\n";
                        //* add the new line at the end of the file
                        if($append == 1) $out .= $varName.' '.$varValue."\n";
                }

                file_put_contents($filename,$out);
        }
}


$sql = "SELECT domain_id, domain, document_root FROM web_domain WHERE stats_type = 'webalizer' AND server_id = ".$conf['server_id'];
$records = $app->db->queryAllRecords($sql);

foreach($records as $rec) {
        //$yesterday = date('Ymd',time() - 86400);
        $yesterday = date('Ymd',strtotime("-1 day", time()));
        $logfile = escapeshellcmd($rec['document_root'].'/log/'.$yesterday.'-access.log');
        if(!@is_file($logfile)) {
                $logfile = escapeshellcmd($rec['document_root'].'/log/'.$yesterday.'-access.log.gz');
                if(!@is_file($logfile)) {
                        continue;
                }
        }

        $domain = escapeshellcmd($rec['domain']);
        $statsdir = escapeshellcmd($rec['document_root'].'/web/stats');
        $webalizer = '/usr/bin/webalizer';
        $webalizer_conf_main = '/etc/webalizer/webalizer.conf';
        $webalizer_conf = escapeshellcmd($rec['document_root'].'/log/webalizer.conf');

        if(is_file($statsdir.'/index.php')) unlink($statsdir.'/index.php');

        if(!@is_file($webalizer_conf)) {
                copy($webalizer_conf_main,$webalizer_conf);
        }

        if(@is_file($webalizer_conf)) {
                setConfigVar($webalizer_conf, 'Incremental', 'yes');
                setConfigVar($webalizer_conf, 'IncrementalName', $statsdir.'/webalizer.current');
                setConfigVar($webalizer_conf, 'HistoryName', $statsdir.'/webalizer.hist');
        }


        if(!@is_dir($statsdir)) mkdir($statsdir);
        exec("$webalizer -c $webalizer_conf -n $domain -s $domain -r $domain -q -T -p -o $statsdir $logfile");
}
Reply With Quote
Sponsored Links
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Webalizer language in Debian Davide Installation/Configuration 1 20th November 2010 02:04
Upgrade Webalizer 2.01 to 2.21 ? userman Installation/Configuration 2 21st March 2010 20:56
Webalizer stats only showing 1 or 2 days? TimeRider General 1 17th August 2009 13:30
missing webalizer stats bolero Installation/Configuration 15 12th November 2008 16:28
Howto: Make Webalizer show full QueryString!! Zoon Tips/Tricks/Mods 1 5th November 2007 02:12


All times are GMT +2. The time now is 03:00.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.