From owner-freebsd-questions@FreeBSD.ORG Fri Jul 18 11:26:15 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B30EA1065672 for ; Fri, 18 Jul 2008 11:26:15 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (gate6.infracaninophile.co.uk [IPv6:2001:8b0:151:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 189048FC15 for ; Fri, 18 Jul 2008 11:26:14 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.2/8.14.2) with ESMTP id m6IBQ7SJ052614; Fri, 18 Jul 2008 12:26:09 +0100 (BST) (envelope-from m.seaman@infracaninophile.co.uk) X-DKIM: Sendmail DKIM Filter v2.6.0 smtp.infracaninophile.co.uk m6IBQ7SJ052614 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infracaninophile.co.uk; s=200708; t=1216380369; bh=1p3V84kz+tdnRi mfJETVpt4MeO6fnew30h4jevaRGrM=; h=Message-ID:Date:From:MIME-Version: To:CC:Subject:References:In-Reply-To:Content-Type:Cc:Content-Type: Date:From:In-Reply-To:Message-ID:Mime-Version:References:To; z=Mes sage-ID:=20<48807DC8.1050007@infracaninophile.co.uk>|Date:=20Fri,=2 018=20Jul=202008=2012:26:00=20+0100|From:=20Matthew=20Seaman=20|Organization:=20Infracaninophile|User -Agent:=20Thunderbird=202.0.0.14=20(X11/20080607)|MIME-Version:=201 .0|To:=20Zbigniew=20Szalbot=20|CC:=20freebsd -questions@freebsd.org|Subject:=20Re:=20log=20size=20handling|Refer ences:=20<487F2525.3030304@lcwords.com>=09<20080717072023.4b9e1d2f. wmoran@potentialtech.com>=09<487F2D9B.2010407@lcwords.com>=09<20080 7170904.26354.mario.lobo@ipad.com.br>=09<487F52EE.2050907@infracani nophile.co.uk>=20<4880748D.8030902@lcwords.com>|In-Reply-To:=20<488 0748D.8030902@lcwords.com>|X-Enigmail-Version:=200.95.6|Content-Typ e:=20multipart/signed=3B=20micalg=3Dpgp-sha256=3B=0D=0A=20protocol= 3D"application/pgp-signature"=3B=0D=0A=20boundary=3D"------------en igC2A2A69491E0239F23419675"; b=F9Ub0uHRwnCcqnbykUb/6BtmV9hYlXzkxLOf tWoaWPQDnhfg7b60MEwDhzIPhx5M6GVTxKYCdy1xeRaRWNCEySJRlBkABwH+MmniPXo ZzE4TqUv+iYItxn+FhEB15hHxnFrJX5EUx/lTpScC6ak65u21jM/HM+B9Mo1Ro0RERA o= Message-ID: <48807DC8.1050007@infracaninophile.co.uk> Date: Fri, 18 Jul 2008 12:26:00 +0100 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 2.0.0.14 (X11/20080607) MIME-Version: 1.0 To: Zbigniew Szalbot 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> In-Reply-To: <4880748D.8030902@lcwords.com> X-Enigmail-Version: 0.95.6 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigC2A2A69491E0239F23419675" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0 (smtp.infracaninophile.co.uk [IPv6:::1]); Fri, 18 Jul 2008 12:26:09 +0100 (BST) X-Virus-Scanned: ClamAV 0.93.1/7744/Fri Jul 18 10:30:23 2008 on happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VERIFIED,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on happy-idiot-talk.infracaninophile.co.uk Cc: freebsd-questions@freebsd.org Subject: Re: log size handling X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jul 2008 11:26:15 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigC2A2A69491E0239F23419675 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Zbigniew Szalbot wrote: > Hello, >=20 > 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= =2E >=20 > So would something like this work? >=20 > /var/log/site-*.log 644 12 * $M1D0 GZC /var/run/httpd.pi= d >=20 > Many thanks in advance! Correct. Although you may want to add '30' as the 8th field -- that mean= s 'send signal 30 (SIGUSR1) to apache instead of SIGHUP' -- SIGUSR1 causes apache to do a graceful restart rather than abruptly killing and restarti= ng everything: http://httpd.apache.org/docs/2.2/stopping.html You'll need to experiment though -- if your user HTTP connections are=20 long-lived, you can end up with apache appending data to a rotated logfil= e 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=20 releases the descriptor the data will disappear into the ether, so you can lose log entries. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW --------------enigC2A2A69491E0239F23419675 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----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----- --------------enigC2A2A69491E0239F23419675--