HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   General (http://www.howtoforge.com/forums/forumdisplay.php?f=15)
-   -   Webalizer not updated since 01 Jan 06? (http://www.howtoforge.com/forums/showthread.php?t=1942)

Zoon 6th January 2006 12:07

Webalizer not updated since 01 Jan 06?
 
Hi,

Webalizer hasn't updated stats since 01 Jan 06, at around 04:00. Is my understanding of this incorrect or should daily stats be show in the interim until monthly summary is available or is it monthly only?

If daily stats should be available (or even can be available?) I would appreciate some help in getting this working. I don't understand how ISPConfig creates the error log and then sends it to Webalizer to parse and generate the stats so I'm really confused at this :confused:

Zoon 6th January 2006 12:17

Not sure if it has any bearing but I'm also getting this email from the nightly cron tasks.

Message 2:
From root@ Fri Jan 6 04:02:41 2006
X-Original-To: root@
Delivered-To: root@
Date: Fri, 6 Jan 2006 04:02:07 GMT
From: root@(Cron Daemon)
To: root@
Subject: Cron <root@emily> run-parts /etc/cron.daily
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>

/etc/cron.daily/0logwatch:

Use of uninitialized value in numeric le (<=) at /etc/cron.daily/0logwatch line 683.
Use of uninitialized value in numeric le (<=) at /etc/cron.daily/0logwatch line 683.
Use of uninitialized value in numeric le (<=) at /etc/cron.daily/0logwatch line 683.
Use of uninitialized value in numeric le (<=) at /etc/cron.daily/0logwatch line 683.
Use of uninitialized value in numeric le (<=) at /etc/cron.daily/0logwatch line 683.
/etc/cron.daily/makewhatis.cron:


zcat: stdout: Broken pipe

zcat: stdout: Broken pipe

falko 6th January 2006 13:17

Quote:

Originally Posted by Zoon
Hi,

Webalizer hasn't updated stats since 01 Jan 06, at around 04:00. Is my understanding of this incorrect or should daily stats be show in the interim until monthly summary is available or is it monthly only?

If daily stats should be available (or even can be available?) I would appreciate some help in getting this working. I don't understand how ISPConfig creates the error log and then sends it to Webalizer to parse and generate the stats so I'm really confused at this :confused:

Webalizer should build statistics every night at around 4:00 AM.
Please have a look at this thread: http://www.howtoforge.com/forums/showthread.php?t=562

I think the mail you get every night is not related to webalizer because webalizer isn't run from /etc/cron.daily.

Zoon 6th January 2006 15:03

Quote:

Try to do a
/etc/init.d/cron stop
pkill cron (Make sure no cron processes are left.)
Edit your crontab (crontab -e) and save it again.
Then restart cron: /etc/init.d/cron start
I did a search on here yesterday and found the above advice. I ran the command yesterday but as of today the stats are still showing last updated 01 Jan 2006 04:00.

I've also tried to run the log.php myself with php -cli but I get the following message:

[root@emily ~]# /root/ispconfig/php/php -cli /root/ispconfig/scripts/shell/logs.php

Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125

Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125

Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125


I haven't made any changes to ISPConfig in this time, and in fact I upgraded to the latest version last night in case that fixed it, but the logs still did not run.

Thanks

Zoon 6th January 2006 15:54

I'm using Fedora Core 4 if it makes any difference.

I checked that thread for further advice and I saw you request ouput from "grep -i cron /var/log/syslog" - I've tried this but that particular log doesn't exist.

Ta

Zoon 6th January 2006 16:09

Checking further, the usage stats in ISPConfig are also showing 0.00mb for this month. I think my problem could be to do with the error message coming from logs.php which I pasted earlier.

// Traffic auswerten und Symlinks für Webalizer aktualisieren
foreach($traffic as $virtual_host => $bytes) {

if(trim($virtual_host) != '') {
// Traffic in DB Schreiben
// Bestimme Web-ID
$link = readlink("$webroot/$virtual_host"); <-- This is line 125
$parts = split("/",$link);
$web_id = intval(substr($parts[count($parts) - 1],3));

if($web_id > 0) {
$verify = $mod->db->queryAllRecords("SELECT * FROM isp_traffic WHERE web_id = '$web_id' AND monat = '$monat_jahr'");
if(empty($verify)){
$mod->db->query("INSERT INTO isp_traffic (web_id, monat, jahr, bytes_web, datum) VALUES ('$web_id','$monat_jahr','$jahr','$bytes','$curren t_time')");
} else {
$mod->db->query("UPDATE isp_traffic SET bytes_web = bytes_web + $bytes WHERE web_id = '$web_id' AND monat = '$monat_jahr'");
}
}

// Symlinks für webalizer korrigieren, falls neuer Monat
if(@readlink("$webroot/$virtual_host/log/web.log") != get_filename($virtual_host)) {
if(is_link("$webroot/$virtual_host/log/web.log")) @unlink("$webroot/$virtual_host/log/web.log");
@symlink(get_filename($virtual_host),"$webroot/$virtual_host/log/web.log");
}
clearstatcache();
$web_owner = @fileowner($webroot."/".$virtual_host."/log");
exec("chown -R ".$web_owner.":web".$web_id." ".$webroot."/".$virtual_host."/log &> /dev/null");
}

}

falko 6th January 2006 16:20

You could put
PHP Code:

echo "$webroot/$virtual_host"

into the logs.php script (just before line 125) and then run that script again. Then check if the directories/files that are displayed do exist on your system.

Zoon 6th January 2006 16:23

Okay thanks ... I tried that and it gives me this

Code:

[root@emily shell]# /root/ispconfig/php/php -cli /root/ispconfig/scripts/shell/logs.php
/home/ffs.zoon.me.uk
Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 126
/home/www.zerofanzone.co.uk/home/emily.laxton.me.uk
Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 126
/home/localhost
Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 126

I'm going to go check those links are okay and probably recreate them.

Zoon 6th January 2006 16:34

The stats have generated now but something still isn't quite right - its giving these error message.

Could you please tell me where the information "readlink("$webroot/$virtual_host");" is drawn from? I think its not correct.

Code:

[root@emily home]# /root/ispconfig/php/php -cli /root/ispconfig/scripts/shell/logs.php
/home/ffs.zoon.me.uk/home/www.zerofanzone.co.uk/home/emily.laxton.me.uk
Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 126
/home/localhost
Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 126
/home/www.zoon.me.uk


falko 6th January 2006 16:55

Please post the output of
Code:

ls -la /home
Quote:

Could you please tell me where the information "readlink("$webroot/$virtual_host");" is drawn from? I think its not correct.
$webroot is taken from the ISPConfig database:
PHP Code:

$webroot stripslashes($server["server_path_httpd_root"]); 

$virtual_host is taken from the Apache access.log:
PHP Code:

if(is_file($access_log)) {
        
$traffic = array();
        
$fd fopen($access_log"r");
        while(!
feof($fd)){

                
$buffer fgets($fd);
                list(
$virtual_host,$bytes,$normal_log) = explode("||||",$buffer);
                
$bytes trim($bytes);
                if(
$bytes != "-"$traffic[$virtual_host] += $bytes;

                
// Logfile schreiben
                
if($virtual_host != '') {

                        if(isset(
$handles[$virtual_host])) {
                                
$h $handles[$virtual_host];
                                unset(
$handles[$virtual_host]);
                                
$handles[$virtual_host] = $h;
                        } else {
                                
// Handle noch nicht in Liste
                                
if(count($handles) > $max_handles) {
                                        unset(
$handles[0]);
                                }
                                
$filename get_filename($virtual_host);
                                
$handles[$virtual_host]= fopen($filename'a');
                        }

                        
$handle $handles[$virtual_host];

                        if (!
fwrite($handle$normal_log)) {
                                
//echo "Cannot write to file ($filename)";
                        
} else {
                                
$zeilen_gesamt++;
                        }
                }
        }
        
fclose ($fd);

        
// die offenen Handles schliessen
        
foreach($handles as $handle) {
                
fclose($handle);
        }

} else {
        die(
"Access log not found: $access_log");




All times are GMT +2. The time now is 19:13.

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