Fwd: newsyslog.conf / rotating logs based on size AND time

Zbigniew Szalbot z.szalbot at lcwords.com
Thu Aug 7 15:25:41 UTC 2008

Hello all,

Would anyone want to comment if it is possible to rotate logs with
newsyslog based on size and time (using FBSD 7.0-Release)?

Many thanks!


-------- Original Message --------
Subject: newsyslog.conf / rotating logs based on size AND time
Date: Tue, 05 Aug 2008 10:17:07 +0200
From: Zbigniew Szalbot <z.szalbot at lcwords.com>
To: User Questions <freebsd-questions at freebsd.org>

Hi there,

I have the following rule in /etc/newsyslog.conf
var/log/*-access.log           644  12    24000    $W2D11 GZC
/var/run/httpd.pid      30

I am trying to see if I can specify to rotate logs when they are larger
then 24MB AND at the start of each month (for testing purposes I entered
today at 11 o'clock - $W2D11).

However, at 10 o'clock the log should have been rotated because of size:
-rw-r--r--  1 root   wheel    24801986 Aug  5 10:02 domain.tld-access.log
but as you can see, it was not.

My question is how can I make sure the logs are rotated when they grow
too large AND they are also rotated at a specified point in time (start
of a new month).

I am reading man newsyslog.conf and it says:

If the when field contains an asterisk (`*'), log rotation will solely
depend on the contents of the size field.

To me it seems to say that when it is not an asterisk (i.e. when I enter
a date), the log rotation is not based solely on size factor, which in
other words should mean it is also based on time?

Any help would be very much appreciated!

Thank you in advance!

Zbigniew Szalbot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3253 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20080807/0cfc5b86/smime.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rcmAttmnt6Kxx9g
Type: protocol/application/x-pkcs7-signature
Size: 23 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20080807/0cfc5b86/rcmAttmnt6Kxx9g.diff

More information about the freebsd-questions mailing list