clear old log files from /var/log

Discussion in 'General' started by harryps, Mar 5, 2015.

  1. harryps

    harryps New Member

    I have about 4gb of old log files on /var/log mainly on /var/log/apache2 the files like access.log.(number).gz are taking a lot of space
    I thought ISPConfig would remove the files older than a month but its removing just the logs under the clients log folder and not the main linux logs
    So can I manually remove the old files under /var/log?
    Is there any way I could set up a cron to clear the files older the a month?
     
  2. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    You should use logrotate to handle your logs (compress, delete...)
     
  3. harryps

    harryps New Member

  4. username

    username New Member

    you can use this cron to remove log older 180 days
    Code:
    #!/bin/sh
    
    find /var/log/ -type f -mtime +180 -delete
     
  5. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    But only the logs in doc-root/log and /var/log/ispconfig/httpd/, but not in /Var/log/apache2 or /var/log/mail.log.
     
  6. harryps

    harryps New Member

    ok i'll set up a cron to remove the logs thanks!
     

Share This Page