Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My /var/log/apache2 folder is getting out of hand. It has loads of old compressed error.log files that I want to get rid of before my server runs out of space and explodes.

Firstly - Is it safe to manually delete:

error.log.1 error.log.2.gz ---> error.log.11?

Secondly is there a way to automatically delete these files?


share|improve this question
logrotate is your friend. – Chopper3 Apr 11 '13 at 17:02
up vote 5 down vote accepted

Yes, it's safe to delete the files though deleting the current file doesn't generally do what you expect.

By default Ubuntu uses logrotate Take a look at your /etc/logrotate.d/apache2 file, you'll probably find that is has a line like

rotate 52

This means it will keep 52 copies of your rotated log files. Change this number to the number you want to keep. This will though work on all the apache2 logs if you want to just do the error log then split it out and give it it's own rules.

share|improve this answer
Thats great, thanks! – Bob Flemming Apr 12 '13 at 8:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.