Skip site navigation (1)Skip section navigation (2)
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
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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48807DC8.1050007>