Date: Thu, 15 Feb 2007 09:16:24 +0000 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: peter@placidpublishing.net Cc: freebsd-questions@freebsd.org Subject: Re: Apache Rotate Logs and Log Rotate Message-ID: <45D424E8.3060300@infracaninophile.co.uk> In-Reply-To: <45D40B6B.7090107@placidpublishing.net> References: <45D40B6B.7090107@placidpublishing.net>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig0B27921C782A0F828560A21E Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Peter Pluta wrote: > I have Apache making separate log files for each of my virtual hosts an= d > putting them in /home/vhostname/log. Rotate logs makes a new log every > 24 hours, but the logs quickly add up and since the sites are fairly > busy the logs are at times over 5gigs. Is there any way to make rotate > logs delete the log files after two days? Someone recommended me Log > Rotate (from the ports tree), but this program does basically what > Rotate logs does; except it makes things more complicated because it > needs to restart apache and such. Is there a easy way to just have > Apache's rotatelogs rotate the logs and then delete them after two days= ? >=20 > Any feedback, suggestions, or comments would be greatly appreciated. rotatelogs doesn't do any sort of deletion stuff. It just doesn't have that capability. On the other hand a simple cronjob that deletes all but the N newest file= s in the directory is just a small matter of scripting. Assuming you want to keep at least 30 of the latest log files, you can generate a list of files to delete by something like: ls -1t /home/vhostname/log.* | sed -n -e '30,$p' Alternatively you can abuse the daily_clean_tmps periodic job to delete any files from that directory over a certain age. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. Flat 3 7 Priory Courtyard PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW, UK --------------enig0B27921C782A0F828560A21E 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.2 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF1CTw3jDkPpsZ+VYRA5reAJoDplP+2OVDZIddbYfkVsSkOtqLaACcD1xt fh0pic+yVGXgqO89txy2V1Q= =Hglw -----END PGP SIGNATURE----- --------------enig0B27921C782A0F828560A21E--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45D424E8.3060300>