1

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.

1
  • 2
    It's quite simple, did you try to read man logrotate?
    – Ency
    Feb 27, 2011 at 11:00

3 Answers 3

3

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.

2

Change the rotate option. It currently keeps 52 weeks.

1

remove or comment out compress in configuration file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .