Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Jan 2011 15:00:20 +0000
From:      Matthew Seaman <>
To:        Grant Peel <>
Subject:   Re: Logrotate
Message-ID:  <>
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)
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:


   [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/ 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/ as the real directory

     and sym-linking -> ->

Make the directory be:


and create symlinks: -> _domain1 -> _domain1 -> _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:     Ramsgate
JID:               Kent, CT11 9PW

Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

Version: GnuPG/MacGPG2 v2.0.16 (Darwin)
Comment: Using GnuPG with Mozilla -



Want to link to this message? Use this URL: <>