Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: [lame logrotate Q]
Date: Sat, 26 Dec 2009 20:01:56
Message-Id: 200912261922.24555.michaelkintzios@gmail.com
In Reply to: [gentoo-user] Re: [lame logrotate Q] by reader@newsguy.com
1 On Monday 21 December 2009 16:14:50 reader@×××××××.com wrote:
2 > Alan McKinnon <alan.mckinnon@×××××.com> writes:
3 > >> I notice that the size part is on its own line which may be the issue.
4 > >
5 > > That will rotate his log when it gets to 100k, and only when it gets to
6 > > 100k. The OP wants to rotate when either the log file is a certain size,
7 > > or every week, whichever comes first.
8 > >
9 > > Logrotate does not support that feature.
10 >
11 > Thanks Alan... saved me dicking around with it endlessly.
12
13 There is a default setting that determines how often files will be rotated if
14 you set this up the top of /etc/logrotate.conf:
15
16 # rotate log files weekly
17 weekly
18
19 This can be overwritten on a file by file basis; e.g.:
20 ===========================================================
21 # no packages own lastlog or wtmp -- we'll rotate them here
22 /var/log/wtmp {
23 monthly
24 create 0664 root utmp
25 rotate 1
26 }
27 ===========================================================
28
29 If you intend to use a different rotating frequency for your file in question
30 then you may want to try this:
31 ===========================================================
32 /var/log/debug.log
33 {
34 create 0600 reader wheel
35 rotate 12
36 weekly
37 size=7000k
38 postrotate
39 /etc/init.d/rsyslog reload > /dev/null 2>&1 || true
40 endscript
41 }
42 ===========================================================
43
44 As far as I know when either the period of one week, or a file size of 7000k
45 is reached the file will be rotated (by whichever condition is met first).
46 Keep an eye on it and play with the file size to confirm that it works for
47 you.
48
49 HTH.
50 --
51 Regards,
52 Mick

Attachments

File name MIME type
signature.asc application/pgp-signature