Apache Rotate Logs and Log Rotate.

David Robillard david.robillard at gmail.com
Mon Mar 5 19:52:28 UTC 2007

On 3/5/07, Peter Pluta <peter at placidpublishing.net> wrote:
> Thanks, David. I had already configured it like that the first time
> around after reading up on it a bit. Most articles/tips I have read say
> to wait 10 minutes or so and then compress the logs with a shell script
> in order to be sure Apache finished logging to the files. Another thing,
> just to be sure. If I had 30 vhosts on my server and each had logs in
> their home directory, I would still use newsyslog to rotate and delete
> them, correct? I assume one needs tons of disk space to do that if the
> sites are rather large.

Well, if you do use newsyslog to rotate Apache log files, then it's
just a matter of setting the number of files you whish to keep. From

  count   Specify the maximum number of archive files which may exist.
	     This does not consider the current log file.

Let's say you rotate your files once they reach 2Mb for example and
that you've configured 10 in your newsyslog,conf <count> field. Then
that means a maximum of 10 x 2Mb = 20Mb will be kept for one
VirtualHost. Now if you have 100 virtual hosts all configured this
way, then you will need 100 x 20Mb = 2000Mb or 2Gb for all your Apache

Considering today's disk drive sizes are well beyond the 300Gb, I
don't think this is a problem at all.

Of course, YMMV so check your own needs and do the math.


David Robillard
UNIX systems administrator & Oracle DBA
CISSP, RHCE & Sun Certified Security Administrator
Montreal: +1 514 966 0122

More information about the freebsd-questions mailing list