Penguin
Blame: LogRotateNotes
EditPageHistoryDiffInfoLikePages
Annotated edit history of LogRotateNotes version 5 showing authors affecting page license. View with all changes included.
Rev Author # Line
1 CraigBox 1 logrotate(8) is a utility for maintenenace of system logs. It allows automatic rotation, compression, removal, and mailing of log files. Each log file can be handled daily, weekly, monthly, or when it grows too large.
2
3 logrotate is run by cron(8) and controlled by a config file (/etc/logrotate.conf) and files stored in /etc/logrotate.d.
4
5 If you want to get logrotate to do something useful for you, add a file in your /etc/logrotate.d directory (eg 'mailout'), containing
6 something like:
7
8 /var/log/logfilename {
9 daily
10 rotate 12
11 compress
12 mail youremail@address.or.alias
13 mailfirst
14 }
15
16 This should mail the logfile out to youremail@address.or.alias whenever logrotate runs - which is your systems 'midnight maintenance' is scheduled
17 to be run (3 or 4 am usually, as most geeks dont like being interrupted at midnight for maintenance ;) To mail it to two ppl, add an alias in
18 /etc/aliases with both email addresses included - this is probably the nicest method.
19
20 It'll keep 12 rotations, and start gzip compressing old logfiles. mailfirst tells it to mail out the most recently rotated logfile (The default is the one about to be killed.)
21
22 This is under DebianLinux. YourMileageMayVary under RedHat but it should be similar.
23
24 Oh, and this is all assuming that you are using syslog(3) to do your logging. If /var/log/logfilename is manually opened by whatever app you are using,
25 I dont know how logrotate will handle it, if at all. you may need to use the postrotate keyword in your logrotate file to trigger a -HUP to your app, or even restart it (icky).
3 CraigBox 26
27 -----
28 If you do not specify a value for the rotate parameter it defaults to 0 (ie. it doesn't rotate any logs, just deletes the old one straight away)
5 PerryLorier 29 -----
30 CategoryNotes