[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Log rotation



On Tue, Apr 01, 2003 at 02:31:29PM -0500, Matthew Daubenspeck wrote:
| On Tue, Apr 01, 2003 at 01:44:24PM -0500, Derrick 'dman' Hudson wrote:
| > It can.  Just be sure to anchor the glob.  For example, using
| > "/var/log/samba/smb*" is really bad because the first rotated file
| > (smb_foo.1) will match as well.  The above anchor with "*.log"
| > prevents "<...>log.1" from matching.
| 
| This is where I run into the problem. The files do not have a .log
| extension. They are in the format of MM.DD.YYYY

So, each day the program creates a new log file with a unique name?
Yeah, that's not the sort of thing logrotate is designed to deal with.
logrotate is designed to take a given log file and make it unique for
each day (or other time period).  Since your application already does
that, try something like this for removing old files :

    find -daystart /var/log/foo -ctime +7 -exec rm \{\} \;

(and run it as a cron job)

HTH,
-D

-- 
Pride goes before destruction,
a haughty spirit before a fall.
        Proverbs 16:18
 
http://dman.ddts.net/~dman/

Attachment: pgpXGM2B0gulp.pgp
Description: PGP signature


Reply to: