Date: Fri, 18 Jul 2008 12:26:00 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: Zbigniew Szalbot <z.szalbot@lcwords.com> Cc: freebsd-questions@freebsd.org Subject: Re: log size handling Message-ID: <48807DC8.1050007@infracaninophile.co.uk> In-Reply-To: <4880748D.8030902@lcwords.com> 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> <4880748D.8030902@lcwords.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] Zbigniew Szalbot wrote: > Hello, > > Matthew Seaman: >>> Do I have to rotate them myself via a script in crontab? >> >> There are several ways to do this. Here's three in addition to the >> script that someone else just posted: >> >> * Use the 'G' option to newsyslog. 'G' says that the filename >> field of newsyslog.conf actually contains a shell globbing pattern >> (wildcard) and files matching that should be rotated and compressed. > > So would something like this work? > > /var/log/site-*.log 644 12 * $M1D0 GZC /var/run/httpd.pid > > Many thanks in advance! Correct. Although you may want to add '30' as the 8th field -- that means 'send signal 30 (SIGUSR1) to apache instead of SIGHUP' -- SIGUSR1 causes apache to do a graceful restart rather than abruptly killing and restarting everything: http://httpd.apache.org/docs/2.2/stopping.html You'll need to experiment though -- if your user HTTP connections are long-lived, you can end up with apache appending data to a rotated logfile that it still has an open file descriptor on. The file will be unlinked once the gzip compression has run. Now, writing to an unlinked file is allowed under Unix, but once that apache child process terminates and releases the descriptor the data will disappear into the ether, so you can lose log entries. Cheers, Matthew -- Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEAREIAAYFAkiAfc8ACgkQ8Mjk52CukIzuGwCfe6N7x/hkl4ALoP6N0xGTT3vm aX4AnitAU2WrihqI2HMnsCtaL7uNfaN4 =bGEv -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48807DC8.1050007>
