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
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
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.
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
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
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','$current_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"); } }
You could put PHP: 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.
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.
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
Please post the output of Code: ls -la /home $webroot is taken from the ISPConfig database: PHP: $webroot = stripslashes($server["server_path_httpd_root"]); $virtual_host is taken from the Apache access.log: PHP: 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");}
I'll have a dig in the database and check nothing has gotten corrupted. In the meantime here you go ... just a few personal sites on there at the mo. Code: [root@emily home]# ls -la /home total 96 drwxr-xr-x 18 root root 4096 Jan 6 16:25 . drwxr-xr-x 23 root root 4096 Nov 29 23:03 .. drwxr-xr-x 3 root root 4096 Sep 14 00:30 127.0.0.1 drwxr-xr-x 4 admispconfig admispconfig 4096 Sep 3 15:27 admispconfig lrwxrwxrwx 1 root root 11 Sep 30 22:07 beardface.nqb-w.net -> /home/web11 lrwxrwxrwx 1 root root 11 Dec 21 22:06 blackfleet.zoon.me.uk -> /home/web18 lrwxrwxrwx 1 root root 11 Jan 6 15:42 emily.laxton.me.uk -> /home/web19 lrwxrwxrwx 1 root root 11 Jan 6 15:26 ffs.zoon.me.uk -> /home/web6/ lrwxrwxrwx 1 root root 11 Nov 28 21:38 lb.zoon.me.uk -> /home/web16 drwxr-xr-x 3 root root 4096 Jan 6 15:28 localhost lrwxrwxrwx 1 root root 10 Sep 24 12:16 princessc.zoon.me.uk -> /home/web8 drwxr-xr-x 7 rich rich 4096 Jan 6 16:25 rich lrwxrwxrwx 1 root root 11 Dec 21 19:26 ts.zoon.me.uk -> /home/web17 drwxr-xr-x 8 apache web11 4096 Oct 1 04:00 web11 drwxr-xr-x 9 apache web12 4096 Oct 17 04:00 web12 drwxr-xr-x 8 apache web14 4096 Oct 17 04:00 web14 drwxr-xr-x 8 apache web16 4096 Nov 29 22:28 web16 drwxr-xr-x 9 apache web17 4096 Dec 22 04:00 web17 drwxr-xr-x 8 apache web18 4096 Dec 22 04:00 web18 drwxr-xr-x 8 apache web19 4096 Jan 6 15:41 web19 drwxr-xr-x 9 web4_richard web4 4096 Jan 5 23:24 web4 drwxr-xr-x 8 web6_zoon web6 4096 Jan 5 23:24 web6 drwxr-xr-x 8 web7_richard web7 4096 Jan 5 23:24 web7 drwxr-xr-x 8 apache 10008 4096 Sep 25 04:00 web8 drwxr-xr-x 8 apache web9 4096 Oct 1 04:00 web9 lrwxrwxrwx 1 root root 10 Sep 14 20:23 www.laxton.me.uk -> /home/web7 lrwxrwxrwx 1 root root 10 Sep 30 19:06 www.totalmodding.co.uk -> /home/web9 lrwxrwxrwx 1 root root 11 Oct 16 21:13 www.zerofanzone.co.uk -> /home/web12 lrwxrwxrwx 1 root root 11 Oct 16 21:15 www.zfzforums.co.uk -> /home/web14 lrwxrwxrwx 1 root root 10 Sep 3 18:10 www.zoon.me.uk -> /home/web4
The database looks OK so I wonder if the links aren't set up right. Code: mysql> select web_host, web_domain from isp_isp_web; +------------+--------------------+ | web_host | web_domain | +------------+--------------------+ | www | zoon.me.uk | | princessc | zoon.me.uk | | ffs | zoon.me.uk | | www | laxton.me.uk | | www | totalmodding.co.uk | | beardface | nqb-w.net | | www | zerofanzone.co.uk | | www | zfzforums.co.uk | | lb | zoon.me.uk | | ts | zoon.me.uk | | blackfleet | zoon.me.uk | | emily | laxton.me.uk | +------------+--------------------+ 12 rows in set (0.00 sec)
Can you put PHP: echo "$webroot/$virtual_host"."\n"; echo readlink("$webroot/$virtual_host")."\n"; (and remove the other echo statement) into the logs.php script before line 125 and run it again? What's the output?
Here you go ... Code: [root@emily ~]# /root/ispconfig/php/php -cli /root/ispconfig/scripts/shell/logs.php /home/ffs.zoon.me.uk /home/web6/ /home/www.zerofanzone.co.uk /home/web12 /home/emily.laxton.me.uk /home/web19 /home/localhost Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 126 Warning: readlink(): Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 127 /home/www.zoon.me.uk /home/web4
Ok, the warnings are related to /home/localhost which wasn't created by ISPConfig and is not a link to another directory. You can ignore it. After you run Code: /root/ispconfig/php/php /root/ispconfig/scripts/shell/logs.php , please also run Code: /root/ispconfig/php/php /root/ispconfig/scripts/shell/webalizer.php Are the statistics generated then?
Yes they are ... the error message is still thrown as before but this time at least they run. I guess the symbolic links were broken and recreating them fixed it Thanks for your help and your prompt replies
I've had the same error, and the log files grow and grow: the script does not trim them down to size each night. I've asked about this a few times, but never got to the bottom of the problem, so I have to manually delete the logs every few days. I wonder what there is about your setup and mine that causes the problem for us, but not for most people.
I never had to delete the log files, and its been working OK since. Its probably related to having large log files, one of the sites that stopped working was a 75,000 hit website so that could have something to do with it.
My problem was the logs from a busy site: about 350,000 pages a month at present - webalyzer reports 1754058 hits in Jan 2006. Maybe the scripts time out before they have processed the log.
Ah... Then you might have to increase PHP's memory limit in /root/ispconfig/php/php.ini. If you have very large log files, then it's likely that PHP will run out of memory unless you increase the memory limit.