Access logs are not recycled

Discussion in 'General' started by Joe-ker, Nov 11, 2005.

  1. Joe-ker

    Joe-ker New Member

    Hi,

    I setup ISPconfig with the debian perfect setup and created 5 sites...

    now i noticed that the access log files of the users (/var/www/web_user/log/2005/11/web.log are growing more and more... I noticed this becouse 2 sites have got quota limits on it, and one of them has exceeded its limit so far...

    which process should delete old content from the file? The option setting in the site is set to default 30% Filesize...
    I only found the process which produces this file (/root/ispconfig/scripts/shell/logs.php)...

    Does anyone know a solution for this problem?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    In the settings of the website, on the options tab, you can set the limit for the logfile in MB or % of the quotasize of the site.
     
  3. Joe-ker

    Joe-ker New Member

    Thats the reason why I posted this here...

    This option doesnt work...!

    Log-Limit is set to default 30% (and the Quota is NOT set to unlimited *g*) and log files are growing more and more...
     
  4. falko

    falko Super Moderator Howtoforge Staff

    Does the log file belong to the correct user and group (user: site administrator, group: web group)?
    Please post the output of
    Code:
    repquota -avug|grep web1
    where you replace web1 with the correct web.
    Also post the output of
    Code:
    ls -l /var/www/web_user/log/2005/11/web.log
     
  5. Joe-ker

    Joe-ker New Member

    repquota for user (i just set the quota higher becouse of this problem... - it should only be at about 50MB):

    web8_ -- 76460 0 0 1743 0 0
    web8 -- 76464 204800 204800 1745 0 0

    la -l users log dir:

    -rw-r--r-- 1 web8_ web8 67740846 Nov 13 00:30 /var/www/web8/log/2005/11/web.log

    in the meantime i found the code that should handle the log limits in the webalizer job... - I will play arround a litte with this script by adding some debug messages and look where it fails...
     
  6. Joe-ker

    Joe-ker New Member

    Hi,

    I got a little step further with my troubleshooting...

    In the webalizer script you can find the following function at about line 154:

    function dir_array($dir){
    if ($dirstream = @opendir($dir)) {
    while (false !== ($filename = readdir($dirstream))) {
    if ($filename!="." && $filename!=".."){
    if (is_file($dir."/".$filename) && !is_link($dir."/".$filename)){
    $directory_array[$dir."/".$filename] = filemtime($dir."/".$filename);
    }
    if (is_dir($dir."/".$filename)) $directory_array = array_merge($directory_array, dir_array($dir."/".$filename));
    }
    }
    }
    closedir($dirstream);
    clearstatcache();
    return $directory_array;
    }


    This function is called at the very end of the script after checking if the logfiles are really bigger than allowed by:

    while($directory_size >= $max_directory_size){
    $files = dir_array($log_dir);
    ...

    the function dir_array produces the following error (its called 3 times for one web...):

    Warning: array_merge(): Argument #1 is not an array in /root/ispconfig/scripts/shell/webalizer.php on line 161

    Warning: array_merge(): Argument #1 is not an array in /root/ispconfig/scripts/shell/webalizer.php on line 161

    Warning: array_merge(): Argument #2 is not an array in /root/ispconfig/scripts/shell/webalizer.php on line 161

    line 161 is the following:
    if (is_dir($dir."/".$filename)) $directory_array = array_merge($directory_array, dir_array($dir."/".$filename));


    Here I get confused from what is checked here and what the commands opendir, readdir, is_link, array_merge are doing in detail - sorry, I really hate arrays if i dont know which values should there be in...

    any ideas?
     
  7. Joe-ker

    Joe-ker New Member

    any php hacker or code maintainer out there who can help me with this issue?

    im not familar enough with php to get an idea what this part of code should really do...

    plz help
     
  8. Ovidiu

    Ovidiu Active Member

    sorry to revive this old thread but I am having the exact same issues. Did anyone get this solved by now?
     
  9. Joe-ker

    Joe-ker New Member

    Sorry - I didnt post my solution...


    after playing around some time with the code I mentioned that the code is fine and should be working...

    I tried to execute the script with my local php version - and tata: it worked fine :)

    I didnt investigate this trouble anymore - I just changed the chrontab to use my local php version and everything is fine...
     

Share This Page