Apache log rotate in Ubuntu

Posted under » Ubuntu » Apache on 08 May 2012

Ever since Hardy Heron, Ubuntu implemented logrotate.d on Apache and Mysql. You may find the configuration here.


What it does by default is that it breaks the log into weekly files every Sunday. So if you have 5 Sundays in a month, you will have 5 files.

After 2 weeks, it compresses the file into a .gz to save space. Therefore if its still one week's old (.log.1) it won't gz the file yet.

The weekly files are numbered according to age and this is what the term "logrotate" comes about. To delete the older log, you delete the largest number.

web security linux ubuntu python django git Raspberry apache mysql php drupal cake javascript css AWS