large log files

Discussion in 'General' started by sygram, Jul 22, 2011.

  1. sygram

    sygram New Member

    Hi there,

    i have noticed that in few websites the log folder is 2.6G . Most of web.log files are larger than 250MB. Is there a way to limit the level of logging ? I believe this will effect stats right ? What is the common practice ?

    Regards,

    Leon
     
  2. falko

    falko Super Moderator

    You can delete old, unused log files to free space.
     
  3. make-fun

    make-fun Member

    If you wanna keep older logs and they are not compressed — like on many Ubuntu 8.04 — you can run this script.

    I just call it from cron, every 2nd of the month and save the output in a logfile.
    Code:
    #!/bin/sh
    # Compressing all log files in User Web
    # Script takes Month as parameter
    # like: ./compressLogs.sh 01
    
    for i in  `find /var/www/web*/log/20*/$1/*.log`
    do
    echo "
    "
    echo "Filesize:         "  `du -h $i`
    echo "Compressing File..."
    gzip $i
    newFile=$i.gz
    echo "New Filesize:             "  `du -h $newFile`
    echo "__________________________________________________________________________"
    done
    Adjust it to YOUR needs!

    Cheers
     

Share This Page