On Monday 21 December 2009 16:14:50 rea...@newsguy.com wrote:
> Alan McKinnon <alan.mckin...@gmail.com> writes:
> >> I notice that the size part is on its own line which may be the issue.
> >
> > That will rotate his log when it gets to 100k, and only when it gets to
> > 100k. The OP wants to rotate when either the log file is a certain size,
> > or every week, whichever comes first.
> >
> > Logrotate does not support that feature.
> 
> Thanks Alan... saved me dicking around with it endlessly.

There is a default setting that determines how often files will be rotated if 
you set this up the top of /etc/logrotate.conf:

# rotate log files weekly
weekly

This can be overwritten on a file by file basis; e.g.:
===========================================================
# no packages own lastlog or wtmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    create 0664 root utmp
    rotate 1
}
===========================================================

If you intend to use a different rotating frequency for your file in question 
then you may want to try this:
===========================================================
/var/log/debug.log 
{
   create 0600 reader wheel
    rotate 12
    weekly
    size=7000k
    postrotate
      /etc/init.d/rsyslog reload > /dev/null 2>&1 || true
    endscript
}
===========================================================

As far as I know when either the period of one week, or a file size of 7000k 
is reached the file will be rotated (by whichever condition is met first).  
Keep an eye on it and play with the file size to confirm that it works for 
you.

HTH.
-- 
Regards,
Mick

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to