From owner-freebsd-questions@FreeBSD.ORG Sun Jan 23 15:00:33 2011 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 9AB591065673 for ; Sun, 23 Jan 2011 15:00:33 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (smtp6.infracaninophile.co.uk [IPv6:2001:8b0:151:1:3fd3:cd67:fafa:3d78]) by mx1.freebsd.org (Postfix) with ESMTP id 0EDDD8FC2A for ; Sun, 23 Jan 2011 15:00:32 +0000 (UTC) Received: from seedling.black-earth.co.uk (seedling.black-earth.co.uk [81.187.76.163]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.4/8.14.4) with ESMTP id p0NF0RlE074909 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 23 Jan 2011 15:00:27 GMT (envelope-from m.seaman@infracaninophile.co.uk) X-DKIM: Sendmail DKIM Filter v2.8.3 smtp.infracaninophile.co.uk p0NF0RlE074909 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=infracaninophile.co.uk; s=201001-infracaninophile; t=1295794827; bh=hk+Hd0cToMeM6OEgoQ41gUqzl++tj8YZR83W2ZBZGFU=; 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=Message-ID:=20<4D3C4284.6010506@infracaninophile.co.uk>|Date:=20S un,=2023=20Jan=202011=2015:00:20=20+0000|From:=20Matthew=20Seaman= 20|User-Agent:=20Mozilla/5.0=20(M acintosh=3B=20U=3B=20Intel=20Mac=20OS=20X=2010.6=3B=20en-US=3B=20r v:1.9.2.13)=20Gecko/20101207=20Thunderbird/3.1.7|MIME-Version:=201 .0|To:=20Grant=20Peel=20|CC:=20freebsd-questi ons@freebsd.org|Subject:=20Re:=20Logrotate|References:=20<71861532 09294859990C5839A572C20F@GRANTLAPTOP>|In-Reply-To:=20<718615320929 4859990C5839A572C20F@GRANTLAPTOP>|X-Enigmail-Version:=201.1.1|Open PGP:=20id=3D60AE908C|Content-Type:=20multipart/signed=3B=20micalg= 3Dpgp-sha1=3B=0D=0A=20protocol=3D"application/pgp-signature"=3B=0D =0A=20boundary=3D"------------enigD0087EEBB9472B65245A9630"; b=kX+HgalX8G+g2lwzkgvasCsqyx6pAG55lH+xjFAp1D+DV15er0dSR+otNr5Kolxzq fI6Vebk0JV8HnhZS/7dH2G3zNTIq7oOpmi+OiZznd31fbkR0KTMeTjK/OYef4UY2F7 +EFnlhekCy3sigKSSTsr+yM4X1z0rJqJ8p8eiDbY= Message-ID: <4D3C4284.6010506@infracaninophile.co.uk> Date: Sun, 23 Jan 2011 15:00:20 +0000 From: Matthew Seaman User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: Grant Peel References: <7186153209294859990C5839A572C20F@GRANTLAPTOP> In-Reply-To: <7186153209294859990C5839A572C20F@GRANTLAPTOP> X-Enigmail-Version: 1.1.1 OpenPGP: id=60AE908C Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigD0087EEBB9472B65245A9630" X-Virus-Scanned: clamav-milter 0.96.5 at lucid-nonsense.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_FAIL autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on lucid-nonsense.infracaninophile.co.uk Cc: freebsd-questions@freebsd.org Subject: Re: Logrotate 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: Sun, 23 Jan 2011 15:00:33 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigD0087EEBB9472B65245A9630 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 23/01/2011 14:10, Grant Peel wrote: > Is there a way or method to ignore the symlinks (or a workaround) that > anyone knows of, other than making a logrotate.conf container for each > individal directory. Use something other than logrotate? Three possibilities: * rotatelogs This is a utility that comes with Apache. To use it, you need to modify your apache config to change the logging directives. Instead of (eg.) CustomLog "/var/log/httpd-access.log" common You'ld use: CustomLog "|/usr/local/sbin/rotatelogs \ /var/log/httpd-access.log 86400" common which will generate a new log file every day at midnight, labelled by the date as the standard seconds-since-the-epoch unit time. (Other time formats can be applied) * cronolog -- in ports as sysutils/cronolog This is rotatelogs on steroids -- it lets you use strftime(3) format codes to build the path and/or filename the logfile is saved as, so you could have a scheme giving paths like: /var/logs/apache22/2011/01/23/virtual-host-name/access_log [One advantage of rotatelogs or cronolog for busy sites -- you get log file rotation without any requirement to restart apache at all. One disadvantage: neither of these programs *delete* over-aged log files. You'll need to write a very small cron job to do that bit.] * newsyslog -- part of the base system. You can use wildcards to match a range of different file names. If you rotate the logs based on age or size, it /should/ only do one cycle per invocation. (Not tested -- so may be completely bogus). Something like: /home/*/logs/access_log 644 14 * 24 GJ /var/run/httpd.pid 30 added to /etc/newsyslog.conf should get you log files rotated once every 24h with two weeks worth kept on hand. Otherwise, you could rearrange your directory structure to give you a unique path distinguishable by globbing. So, instead of having: /home/domain1.com as the real directory and sym-linking domain1.net -> domain1.com domain1.org -> domain1.com Make the directory be: /home/_domain1/ and create symlinks: domain1.com -> _domain1 domain1.net -> _domain1 domain1.org -> _domain1 Then you can wildcard as '/home/_*/logs/access_log' [Note '_' was chosen because that character is specifically disallowed in host / domain names: it's guaranteed not to accidentally collide] Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate JID: matthew@infracaninophile.co.uk Kent, CT11 9PW --------------enigD0087EEBB9472B65245A9630 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.16 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk08QooACgkQ8Mjk52CukIzGwwCghuhZoU1ZuTMD1eOYgHAuUH+C uPwAn1RMlw3fL8Qpe69wrL9X5s1/aZid =MPBe -----END PGP SIGNATURE----- --------------enigD0087EEBB9472B65245A9630--