Logrotate - daily log files for a month

Mikkel L. Ellertson mikkel at infinity-ltd.com
Thu Aug 23 15:32:28 UTC 2007


John Horne wrote:
> On Thu, 2007-08-23 at 09:58 -0500, Mikkel L. Ellertson wrote:
>> You can control how many old log files are kept by changing "rotate
>> 4" to how many weeks of backlogs you want to keep, This is in
>> /etc/logrotate.conf. You can control individual logs by editing the
>> corresponding file in /etc/logrotate.d and adding/changing the
>> rotate line. You can find more information by running "man logrotate".
>>
> ? We want daily log files, so setting 'rotate 4' will only give us 4 log
> files. Using weeks is no good because a month is not a fixed number of
> weeks - 30 and 31 days are not 4 weeks and vice-versa.
> 
If you are using daily instead of weekly, then set rotate to 31 to
keep the max number of days a month can have. Then add a monthly
cron job to archive the month of logs if you want to keep them. By
using 31 as the number of logs to keep, you insure you have at least
a months worth of logs. If the month has less the 31 days, you will
have 1 or more daily logs from last month left over.

Mikkel
-- 

  Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20070823/df220459/attachment-0002.bin 


More information about the users mailing list