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

On one of my servers I have following in /etc/logrotate.d/apache2

/var/log/apache2/*.log {
        rotate 52
        create 640 root adm
                if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/}`" ]; then
                        /etc/init.d/apache2 reload > /dev/null

What I observed is I get each week a gz file. I do not want it to save just delete at the end of 15 days(or size 100M) how can this be done? What do I need to add above? It is a Ubuntu 10.04 server.

share|improve this question
It's quite simple, did you try to read man logrotate? – Ency Feb 27 '11 at 11:00
up vote 3 down vote accepted

rotate 52 indicates that you want to keep the last 52 logs. Set it to 0 to have old logs deleted.

You'd need to add a size 100M to make it rotate at 100MB.

As for the 15 days part, your choices are daily, weekly, or monthly. You can combine that with the size option so that it'll rotate it when it's over 100MB or when its time is up.

share|improve this answer

Change the rotate option. It currently keeps 52 weeks.

share|improve this answer

remove or comment out compress in configuration file.

share|improve this answer

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.