Date: Sun, 23 Jan 2011 15:00:20 +0000 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: Grant Peel <gpeel@thenetnow.com> Cc: freebsd-questions@freebsd.org Subject: Re: Logrotate Message-ID: <4D3C4284.6010506@infracaninophile.co.uk> In-Reply-To: <7186153209294859990C5839A572C20F@GRANTLAPTOP> References: <7186153209294859990C5839A572C20F@GRANTLAPTOP>
next in thread | previous in thread | raw e-mail | index | archive | help
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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D3C4284.6010506>
