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

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

/var/log/apache2/*.log {
        weekly
        missingok
        rotate 52
        compress
        delaycompress
        notifempty
        create 640 root adm
        sharedscripts
        postrotate
                if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`" ]; then
                        /etc/init.d/apache2 reload > /dev/null
                fi
        endscript
}
~                  

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
2  
It's quite simple, did you try to read man logrotate? –  Ency Feb 27 '11 at 11:00

3 Answers 3

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

 
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.