Matthew Seaman m.seaman at infracaninophile.co.uk
Sun Jan 23 15:00:33 UTC 2011

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:


   [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:


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]



Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
JID: matthew at infracaninophile.co.uk               Kent, CT11 9PW

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 267 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20110123/64c35e26/signature.pgp

More information about the freebsd-questions mailing list