Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

Thanks!

share|improve this question
1  
logrotate is your friend. –  Chopper3 Apr 11 '13 at 17:02

1 Answer 1

up vote 2 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

 
discard

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.