[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-users] webalizer missing days solution



Hi All,

Here is a fix for the webalizer missing days problem. Previously I've tried
the other solutions and they did not seem to work. What the fix below does
is check the date of the gzipped file, if the date is the same as the
web.log then it first gunzips the web.log.1.gz and runs the webalizer on it.
Then it runs the webalizer on the  web.log file as it normally would.

In the /etc/cron.daily/webalizer.pl  just insert the code below after the
"# Now just run webalizer"    line. Each line ends with a   ;   so watch for
the line wraps.

    # Now just run webalizer
     #####################################################################
     #run the gzipped version first if the dates match

     $ls=`ls -la $prefix/$asite/logs/web.log`;
     $lsg=`ls -la $prefix/$asite/logs/web.log.1.gz`;
     $ls =~ s/\s+/ /g;
     $lsg =~ s/\s+/ /g;
     (@lsarray) = split(/ /,$ls);
     (@lsgarray) = split(/ /,$lsg);
     $gseg6 = @lsgarray[6];
     $seg6  = @lsarray[6];
     $gseg5 = @lsgarray[5];
     $seg5  = @lsarray[5];

     if  (  (($gseg6 eq $seg6) and ($gseg5 eq $seg5)) or ($ls =~ /No Such
File/)  )   {
       print "do it for $ls\n";
       print "do it     $lsg \n\n\n";
       chdir "$prefix/$asite/logs/" or die "Can't cd to $prefix??: $!\n";
       system ("mv $prefix/$asite/logs/web.log
$prefix/$asite/logs/web.log.new");
       system ("cp $prefix/$asite/logs/web.log.1.gz
$prefix/$asite/logs/web.log.1.new.gz");
       system ("gunzip $prefix/$asite/logs/web.log.1.gz");
       system ("mv  $prefix/$asite/logs/web.log.1
$prefix/$asite/logs/web.log");
       $messages .=  `/usr/local/bin/webalizer -p -n $asite -s $asite -r
$asite -q -Q -T -o $thepath $prefix/$asite/logs/web.log`;
       system ("mv $prefix/$asite/logs/web.log.1.new.gz
$prefix/$asite/logs/web.log.1.gz");
       system ("mv $prefix/$asite/logs/web.log.new
$prefix/$asite/logs/web.log");
     }




----
Ken Marcus
Precision Web Hosting
mailto:ken@xxxxxxxxxxxxxxxx
http://www.precisionweb.net