Date: Thu, 17 Jul 2008 11:56:51 -0700 From: David Newman <dnewman@networktest.com> To: freebsd-questions@freebsd.org Subject: Re: log size handling Message-ID: <487F95F3.1080006@networktest.com> In-Reply-To: <487F52EE.2050907@infracaninophile.co.uk> References: <487F2525.3030304@lcwords.com> <20080717072023.4b9e1d2f.wmoran@potentialtech.com> <487F2D9B.2010407@lcwords.com> <200807170904.26354.mario.lobo@ipad.com.br> <487F52EE.2050907@infracaninophile.co.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
On 7/17/08 7:10 AM, Matthew Seaman wrote: > * Use the rotatelogs program that comes with Apache. In this case, > you replace the logging configuration statements in https.conf > eg. instead of: > > CustomLog "/var/log/httpd-access.log" combine > > you have: > > CustomLog "|/usr/local/sbin/rotatelogs /var/log/httpd-access.log > 86400" > > which will create a new log file every 86400 seconds (= 1 day) and > label each one with the unix time it was created appended to the > name. eg: > > /var/log/httpd-access.log.1216252800 > > That will change files at midnight UTC each day, which is fine > if your server lives in the UK but not quite as convenient if your > server is in Australia. Yes. Apache's rotatelogs is a better choice than newsyslog. Under heavy load, the latter can corrupt Apache logs. rotatelogs also can do changes based on log size, like this: CustomLog "|/usr/local/sbin/rotatelogs/var/log/httpd-access.log 5M" \ combined and if you don't like deciphering Unix epoch time, you can embed times in your log filenames like this: CustomLog "|/usr/local/sbin/rotatelogs \ /var/log/httpd-access.log.%Y-%m-%d-%H_%M_%S 86400" combined (n.b. I added the backslashes in the examples here; you want everything on a single line in your config file.) dn
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?487F95F3.1080006>