log files, rotation and emailing them

Discussion in 'General' started by hairydog2, Nov 25, 2005.

  1. hairydog2

    hairydog2 New Member

    I'm bit puzzled about what happens to web server logs after they have been split off and analysed by webalizer.

    They seem to get put into a directory for each month, but what happens then? Do they get deleted?

    I think I'd like to have some emailed away but i'm not sure where to set this.

    This may become a bit of an issue, becasue I notice that one of the sites has managed to collect 50MB of web server log since Monday. Give that a few months and it'll get silly.
     
  2. till

    till Super Moderator

    The log files where deleted if they get too big. You can set the max. log size in the settings of the site in percent and absolute (MB).
     
  3. falko

    falko Super Moderator

    The deletion of log files is handled at the end of /root/ispconfig/scripts/shell/webalizer.php. So if you don't like the way ISPConfig handles it you can try to tweak that file.:)
     
  4. hairydog2

    hairydog2 New Member

    Thanks for the information, till and falco.

    Is there an easy way to have the logs gz compressed?

    Is there an easy way to have them emailed out before they are deleted?
     
  5. till

    till Super Moderator

    As falko posted above, you will have to change the script /root/ispconfig/scripts/shell/webalizer.php if you want to have another behaviour .
     
  6. hairydog2

    hairydog2 New Member

    You are assuming I know how to change this without messing it up!

    What I am looking for is the equivalent of what I have in the logrotate settings on my old server: something like

    ========================

    compress
    /www/logs/siteaddress.co.uk-transfer {
    daily
    rotate 2
    mail weblogs@siteaddress.co.uk
    }

    ========================

    Can I put something like that in there? If so, how? If not, is there any way to use logrotate to do this?
     
  7. hairydog2

    hairydog2 New Member

    I have a small problem with this: it won't work for me!

    Each day I have tried putting one of:
    50MB
    50
    50 MB
    and waiting until the next day, but each time the log is way bigger than I have set.

    What is the proper format for this setting, and exactly how should it work?
     
  8. hairydog2

    hairydog2 New Member

    Can't anyone tell me what the correct format for this entry should be?
     
  9. till

    till Super Moderator

    The problem is that the webfiles have the name of the current month and are written in a directory with the name of the current yrear. I dont know if logrotate supports that. Maybe you can use the symlink "web.log" that points to the current web logfile for logrotate, bu i guess you will get problems when you use two logrotation mechanisms together.
     
  10. hairydog2

    hairydog2 New Member

    Sorry, I wasn't asking clearly enough.

    All I want to know is what to put in the field of ISPConfig to replace the default 30% so that it is a hard limit of 50MB.

    I can worry about logrotate at a later date.
     
  11. till

    till Super Moderator

    Simply add "50". If there is no procent sign, ISPConfig treats it as absolute number in MB.
     
  12. hairydog2

    hairydog2 New Member

    That seems to work fine, thanks. With one exception. It ends up leaving a 50MB file in the log directory for each month, so you'd end up with 600MB after a year!
     
  13. hairydog2

    hairydog2 New Member

    Broken again!

    I spoke too soon!

    The log file has started to grow again. A couple of days ago, I tried setting it to 18% and the user's webspace is 250MB. The logfile is now at 243956956 bytes.

    I've just changed the setting again, back to 50 but I don't think that will work either.

    I wonder if for some reason webalyzer isn't finishing working through the log files and timing out. The next time, the log is that much bigger, so it gets stuuck again.

    Is there a timeout setting I can adjust somewhere?
     
  14. till

    till Super Moderator

    You can run these scripts manually and cjeck if they time out:

    /root/ispconfig/php/php /root/ispconfig/scripts/shell/logs.php
    /root/ispconfig/php/php /root/ispconfig/scripts/shell/webalizer.php
     
  15. hairydog2

    hairydog2 New Member

    Thanks for the suggestion.
    That did give an error: "Invalid argument in /root/ispconfig/scripts/shell/logs.php on line 125"

    Line 125 says: $link = readlink("$webroot/$virtual_host");

    Is there a problem here?
     
  16. till

    till Super Moderator

    Maybe a symlink (domainname => webID directory) is missing for one of your websites.

    Did you delete anything manually in the web root directory (/var/www or /home/www)?
     
  17. hairydog2

    hairydog2 New Member

    I've not knowingly deleted anything. But it is possible. What should there be?

    In /home/www there are 54 directories (which are symlinks) called www.hostname.co.uk or similar, 52 directories called web1 to web 61 with a few missing, one directory called localhost and one symlink called hosting.hairydog.co.uk

    However the server is now called www.hdog.co.uk Could that be the trouble?
     
  18. hairydog2

    hairydog2 New Member

    I've looked more closely (and counted more accurately). I notice that one of the www.hostnames is not a symlink: it is an actual directory. I could remove this and recreate it, because it is a domain that isn't yet in use.

    At present there are 54 symlinks and 54 directories. There is one webnn directory with no symlink and one www.hostname.co.uk directory instead of a symlink

    I also also notice that there are two symlinks to one directory and another two to a (different) same directory.
     
  19. hairydog2

    hairydog2 New Member

    I've removed the directory with no symlink, removed the duplicate symlinks and all looks OK, but I still get the same error message.
     
  20. till

    till Super Moderator

    Can you add this line before the line $link = readlink("$webroot/$virtual_host");:

    Code:
    echo "$webroot/$virtual_host\n";
    This will output the values and we can see when its stops.
     

Share This Page