Results 1 to 2 of 2
Hi there, I was hoping someone could help me with logrotate not behaving as I would expect it to. Probably a simple one:
So I have a big apache log ...
- 05-09-2011 #1Just Joined!
- Join Date
- May 2011
- Posts
- 1
Help With Logrotate
Hi there, I was hoping someone could help me with logrotate not behaving as I would expect it to. Probably a simple one:
So I have a big apache log that I want to rotate when it reaches 20Meg:
-rw-r--r-- 1 apache apache 134M May 9 08:58 access_log
-rw-r--r-- 1 apache apache 3.1M May 9 05:49 error_log
My config is like so:
/var/www/vhosts/mydomain/statistics/logs/*log {
size 20M
compress
delaycompress
create 640 apache apache
rotate 6
sharedscripts
postrotate
if [ -f /var/run/httpd.pid ]; then
/etc/init.d/httpd restart > /dev/null
fi
endscript
}
I would expect to see 6 logfiles of 20Meg each, but it just dumps everything to access_log.1. Whats wrong here?
-rw-r--r-- 1 apache apache 0 May 9 09:08 access_log
-rw-r--r-- 1 apache apache 134M May 9 09:07 access_log.1
-rw-r--r-- 1 apache apache 3.1M May 9 05:49 error_log
Many thanks
Tom
- 05-09-2011 #2Linux Guru
- Join Date
- Nov 2007
- Posts
- 1,695

You have 1 log. The rule can't do anything about your logs *in the past.* The final size will depend on how much it compresses - which you have set to delaycompress, so that won't happen until the first log is rotated to the 2ND log.
It's all in the manual.


Reply With Quote