compressing web.log files

Discussion in 'Tips/Tricks/Mods' started by todvard, Jul 12, 2006.

  1. todvard

    todvard ISPConfig Developer

    Hi all,

    i have found that the old log files in webxx/log folders are too big, thats why i have created this bash script to compress those files.
    The script is short (and ugly too, i know :), but it's working ):

    for i in  `find /var/www/ -type f -mtime +2 -name web.log | grep -v "/\`date +%m\`/"` ; do gzip $i; done
    Run it from cron every day, after ISPConfig's log.php script (which is running 0.30 AM every day in the default installation)
  2. fobicodam

    fobicodam ISPConfig Developer

    mmm are this logs files usefull for something? if after the zip every is ok, i prefer to delete them...
  3. TheRudy

    TheRudy ISPConfig Developer

    Site gets hacked while you are away for 2 days, you can check logs if you still have them.. :) So yeah, they can be usefull
  4. fobicodam

    fobicodam ISPConfig Developer

    mmm Site has been hacked, im away two days... should i check a 2 Gb text file to see whats modified or should i restore a backup?... my choice is a backup..
  5. todvard

    todvard ISPConfig Developer

    If you want to avoid to be hacked for second time, then yes, you should check those 2GB text files :) anyway, it is up to you.
  6. TheRudy

    TheRudy ISPConfig Developer

    What todvard said.. but it is indeed decision made by you, if you use backup thinking that bug will be resolved by itself then fine by me.. :D
  7. falko

    falko Super Moderator

    There's also a legal reason: in some countries you must keep log files for at least a few months if you provide hosting services.
  8. fobicodam

    fobicodam ISPConfig Developer

    Im lucky its not here.. but anyway, my big problem is the 2Gb limit for files. Can i somehos change the script to not append everyday log file to the bi main file? i mean, save daily log in separate files?
  9. till

    till Super Moderator

    If you split the log in daily files, you might get problems with the webalizer stats generation.

    You can try this by modifying the script /root/ispconfig/scripts/shell/logs.php

Share This Page