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.
rotate 52
indicates that you want to keep the last 52 logs. Set it to0
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.
Change the rotate option. It currently keeps 52 weeks.
remove or comment out
compress
in configuration file.