From owner-freebsd-questions@FreeBSD.ORG Thu Feb 15 09:17:07 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7216C16A407 for ; Thu, 15 Feb 2007 09:17:07 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (ns0.infracaninophile.co.uk [81.187.76.162]) by mx1.freebsd.org (Postfix) with ESMTP id B834213C49D for ; Thu, 15 Feb 2007 09:17:06 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from [172.16.3.238] (gateway.ash.thebunker.net [213.129.64.4]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.13.8/8.13.8) with ESMTP id l1F9GWnC013309 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 15 Feb 2007 09:16:46 GMT (envelope-from m.seaman@infracaninophile.co.uk) Message-ID: <45D424E8.3060300@infracaninophile.co.uk> Date: Thu, 15 Feb 2007 09:16:24 +0000 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 1.5.0.9 (X11/20070123) MIME-Version: 1.0 To: peter@placidpublishing.net References: <45D40B6B.7090107@placidpublishing.net> In-Reply-To: <45D40B6B.7090107@placidpublishing.net> X-Enigmail-Version: 0.94.0.0 Content-Type: multipart/signed; micalg=pgp-ripemd160; protocol="application/pgp-signature"; boundary="------------enig0B27921C782A0F828560A21E" X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-3.0 (smtp.infracaninophile.co.uk [81.187.76.162]); Thu, 15 Feb 2007 09:17:01 +0000 (GMT) X-Virus-Scanned: ClamAV 0.88.7/2571/Thu Feb 15 08:06:05 2007 on happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00, DKIM_POLICY_TESTING autolearn=ham version=3.1.7 X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on happy-idiot-talk.infracaninophile.co.uk Cc: freebsd-questions@freebsd.org Subject: Re: Apache Rotate Logs and Log Rotate 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: Thu, 15 Feb 2007 09:17:07 -0000 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--