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

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 18th November 2012, 23: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
  #2  
Old 19th November 2012, 09:29
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 37,001
Thanks: 840
Thanked 5,650 Times in 4,460 Posts
Default

Most likely the timezone setting in /usr/local/ispconfig/server/lib/config.inc.php is wrong. Change it to match your timezone.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 19th November 2012, 10:42
TKoos TKoos is offline
Junior Member
 
Join Date: Nov 2012
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi! Thanks for your answer.

When I accessed the correct server I found the TimeZone settings. :-)

However changing 'UTC' to 'UTC+1' was wrong, how should it be written?

changed row:
$conf['timezone'] = 'UTC+1';

error message:
PHP Notice: date_default_timezone_set(): Timezone ID 'UTC+1' is invalid in /usr/local/ispconfig/server/lib/app.inc.php on line 32
finished.


Best regards,

TKoos


Quote:
Originally Posted by till View Post
Most likely the timezone setting in /usr/local/ispconfig/server/lib/config.inc.php is wrong. Change it to match your timezone.

Last edited by TKoos; 19th November 2012 at 10:56.
Reply With Quote
  #4  
Old 19th November 2012, 11:36
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 37,001
Thanks: 840
Thanked 5,650 Times in 4,460 Posts
Default

The config.inc.php file contains a link to the timezone list in the comment of this setting were the names of all timezones available in php are listed.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
The Following User Says Thank You to till For This Useful Post:
TKoos (19th November 2012)
  #5  
Old 19th November 2012, 12:05
TKoos TKoos is offline
Junior Member
 
Join Date: Nov 2012
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by till View Post
The config.inc.php file contains a link to the timezone list in the comment of this setting were the names of all timezones available in php are listed.
Great! Now I've got it right.

If anyone else has the same problem there is a list of the availble timezones here:
http://www.php.net/manual/en/timezones.europe.php
Reply With Quote
  #6  
Old 5th November 2013, 16:19
miguelal miguelal is offline
Junior Member
 
Join Date: Mar 2010
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks for sharing. I had the same problem.

But now how do I force webalizer to get up-to-date without waiting until tomorrow?
Reply With Quote
  #7  
Old 6th November 2013, 03:55
orasis orasis is offline
Senior Member
 
Join Date: Mar 2007
Posts: 183
Thanks: 13
Thanked 13 Times in 13 Posts
Default

In my case I first used awstats for a site, then switched it to webalizer and it didn't like it, I had 'Internal Server Error' so I suspected it was an issue with the .htaccess file. Then I wiped out the /stats/ directory contents and recreated a password for the stats, having set 'webalizer'. It created the .htaccess and .htpasswd but not any index.php or index.html so I though, ok I will wait until tomorrow.

Today is the tomorrow and nothing yet although I visited the site
I think webalizer is problematic itself ?

By the way, any chance of changing the default username from 'admin' to a custom one for the /stats/ directory without hacks ?
I would also like the ability to move, choose a name for this directory, or disable stats completely in future versions if possible.
cheers

Last edited by orasis; 6th November 2013 at 04:01.
Reply With Quote
  #8  
Old 6th November 2013, 12:45
miguelal miguelal is offline
Junior Member
 
Join Date: Mar 2010
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

In ISPConfig 2 there were 2 php scripts you ran to have the stats updated.

Webalizer is a very solid and stable product. I've used it for a decade now. In fact I remember "back in the days" when I administered a single domain on a dedicated server without ISPConfig I did do a webalizer stat update through the command line. I suppose I'll Google-it.

If I find something I'll post here.
Reply With Quote
  #9  
Old 6th November 2013, 13:07
orasis orasis is offline
Senior Member
 
Join Date: Mar 2007
Posts: 183
Thanks: 13
Thanked 13 Times in 13 Posts
Default

you mean to force update huh ?

hm ... I jsut tested again and I still get
Code:
Forbidden

You don't have permission to access /stats/ on this server.
.. cause it finds no index file inside... maybe I just broke it compeltely by deleting the directory contents !

Last edited by orasis; 6th November 2013 at 13:10.
Reply With Quote
  #10  
Old 6th November 2013, 13:46
Croydon Croydon is offline
ISPConfig Developer
 
Join Date: Jul 2007
Location: Koblenz, Germany
Posts: 932
Thanks: 16
Thanked 264 Times in 208 Posts
 
Default

I think the index.php is generated when ispconfig runs it's daily cron.
I'm not completely sure, but did the daily ispconfig cron already run since you deleted the directory?
__________________
Marius Cramer

pixcept KG
Reply With Quote
Reply

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 03:04
Upgrade Webalizer 2.01 to 2.21 ? userman Installation/Configuration 2 21st March 2010 21:56
Webalizer stats only showing 1 or 2 days? TimeRider General 1 17th August 2009 14:30
missing webalizer stats bolero Installation/Configuration 15 12th November 2008 17:28
Howto: Make Webalizer show full QueryString!! Zoon Tips/Tricks/Mods 1 5th November 2007 03:12


All times are GMT +2. The time now is 21:59.


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