Re: [SLE] What does logrotate do?
From: Patrick Shanahan (paka_at_wahoo.no-ip.org)
Date: 09/28/04
- Previous message: Randall R Schulz: "Re: [SLE] re: why wont my suse compile"
- In reply to: Paul W. Abrahams: "Re: [SLE] What does logrotate do?"
- Next in thread: Paul W. Abrahams: "Re: [SLE] What does logrotate do?"
- Reply: Paul W. Abrahams: "Re: [SLE] What does logrotate do?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 27 Sep 2004 23:03:06 -0500 To: suse-linux-e@suse.com
* Paul W. Abrahams <abrahams@acm.org> [09-27-04 22:03]:
> On Monday 27 September 2004 10:08 pm, James Knott wrote:
>
> > What it does, is at a schedule, create dated copies of the various
> > log files, with the oldest file being deleted. This is to prevent
> > the disk filling up with logs and also separating parts of the log by
> > date, to make it easier to find info.
>
> So I guess it's not particularly helpful for what I'd like to do with a
> specialized logfile: delete all entries that are more than two weeks
> old. I could use "tail" in a short shell script to do a length-based
> truncation, but it's not clear how to do a date-based truncation,
> assuming every entry starts with a date. It's programmable, of course,
> but not simple.
Why dismiss something without looking into it? The description
provided above is accurate but very terse. You should read the
man/info pages before making rash decisions.
> Is there some kind of utility around that does date-based truncation?
Certainly, and the parameters are simple and straight forward with
good documentation. The utility you want is *logrotate*.
ie:
/etc/logrotate/apache2 (partial):
/var/log/apache2/access_log {
compress compress the archive
dateext rename by date
maxage 365 oldest before rotate
rotate 99 delete 100th file
size=+4096k max file size before rotate
notifempty only rotate if not empty
missingok no error if missing
create 644 root root permissions on archive
postrotate do commands after rotate
/etc/init.d/apache2 reload restart apache2
endscript finished this script
}
*read* the man/info file.....
I rotate my fetchmail logs:
/var/log/fetchmail {
compress
dateext
maxage 365
rotate 99
size=+1024k
notifempty
missingok
copytruncate
}
-- Patrick Shanahan Registered Linux User #207535 http://wahoo.no-ip.org @ http://counter.li.org HOG # US1244711 Photo Album: http://wahoo.no-ip.org/photos -- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
- Previous message: Randall R Schulz: "Re: [SLE] re: why wont my suse compile"
- In reply to: Paul W. Abrahams: "Re: [SLE] What does logrotate do?"
- Next in thread: Paul W. Abrahams: "Re: [SLE] What does logrotate do?"
- Reply: Paul W. Abrahams: "Re: [SLE] What does logrotate do?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|