~ubuntu-branches/ubuntu/quantal/logrotate/quantal

« back to all changes in this revision

Viewing changes to logrotate.8

  • Committer: Bazaar Package Importer
  • Author(s): Lorenzo De Liso
  • Date: 2010-07-14 19:34:54 UTC
  • mfrom: (4.1.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100714193454-ihz13w539ca2jz18
Tags: 3.7.8-6ubuntu1
* Merge from debian unstable (LP: #554823), remaining changes:
  - debian/control: Drop mailx to Suggests for Ubuntu; it's only used
    on request, and we don'c configure an MTA by default.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
weekly, monthly, or when it grows too large.
12
12
.P
13
13
Normally, \fBlogrotate\fR is run as a daily cron job.  It will not modify
14
 
a log multiple times in one day unless the criterium for that log is
15
 
based on the log's size and \fBlogrotate\fR is being run multiple times
16
 
each day, or unless the \fB-f\fR or \fB-force\fR option is used. 
 
14
a log more than once in one day unless the criterion for that log is
 
15
based on the log's size and \fBlogrotate\fR is being run more than once
 
16
each day, or unless the \fB-f\fR or \fB-force\fR option is used.
17
17
.P
18
18
Any number of config files may be given on the command line. Later config
19
19
files may override the options given in earlier files, so the order
48
48
Tells \fBlogrotate\fR which command to use when mailing logs. This
49
49
command should accept two arguments: 1) the subject of the message, and
50
50
2) the recipient. The command must then read a message on standard input
51
 
and mail it to the recipient. The default mail command is \fB/bin/mail
 
51
and mail it to the recipient. The default mail command is \fB/usr/bin/mail
52
52
-s\fR.
53
53
 
54
54
.TP
55
 
\fB-s, -\-state <statefile>\fR
 
55
\fB-s\fR, \fB-\-state <statefile>\fR
56
56
Tells \fBlogrotate\fR to use an alternate state file.  This is useful
57
57
if logrotate is being run as a different user for various sets of
58
 
log files.  The default state file is \fI/var/lib/logrotate.status\fR.
 
58
log files.  The default state file is \fI/var/lib/logrotate/status\fR.
59
59
 
60
60
.TP
61
61
\fB-\-usage\fR
63
63
 
64
64
.TP
65
65
\fB-v\fR, \fB-\-verbose\fR
66
 
Turns on verbose mode.
 
66
Turns on verbose mode, ie. display messages during rotation.
67
67
 
68
68
.SH CONFIGURATION FILE
69
69
 
112
112
The first few lines set global options; in the example, logs are
113
113
compressed after they are rotated.  Note that comments may appear
114
114
anywhere in the config file as long as the first non-whitespace
115
 
character on the line is a #.
 
115
character on the line is a \fB#\fR.
116
116
 
117
 
The next section of the config files defined how to handle the log file
 
117
The next section of the config file defines how to handle the log file
118
118
\fI/var/log/messages\fR. The log will go through five weekly rotations before
119
119
being removed. After the log file has been rotated (but before the old
120
120
version of the log has been compressed), the command 
122
122
 
123
123
The next section defines the parameters for both
124
124
\fI/var/log/httpd/access.log\fR and \fI/var/log/httpd/error.log\fR.
125
 
They are rotated whenever it grows over 100k in size, and the old logs
 
125
Each is rotated whenever it grows over 100k in size, and the old logs
126
126
files are mailed (uncompressed) to www@my.org after going through 5
127
127
rotations, rather than being removed. The \fBsharedscripts\fR means that
128
128
the \fBpostrotate\fR script will only be run once (after the old logs have 
129
 
been compressed), not once for each log which is rotated. Note that the double
130
 
quotes around the first filename at the beginning of this section allows
131
 
logrotate to rotate logs with spaces in the name. Normal shell quoting rules
132
 
apply, with ', ", and \\ characters supported.
 
129
been compressed), not once for each log which is rotated.
 
130
Note that log file names may be enclosed in
 
131
quotes (and that quotes are required if the name contains spaces).
 
132
Normal shell quoting rules apply, with \fB'\fR, \fB"\fR, and \fB\\\fR
 
133
characters supported.
133
134
 
134
135
The last section defines the parameters for all of the files in
135
136
\fI/var/log/news\fR. Each file is rotated on a monthly basis.  This is
140
141
rotate all files, including previously rotated ones.  A way around this
141
142
is to use the \fBolddir\fR directive or a more exact wildcard (such as *.log).
142
143
 
 
144
If the directory \fI/var/log/news\fR does not exist, this will cause
 
145
\fBlogrotate\fR to report an error. This error cannot be stopped with
 
146
the \fBmissingok\fR directive.
 
147
 
143
148
Here is more information on the directives which may be included in
144
149
a \fBlogrotate\fR configuration file:
145
150
 
151
156
.TP
152
157
\fBcompresscmd\fR
153
158
Specifies which command to use to compress log files.  The default is
154
 
\fBgzip\fR.  See also \fBcompress\fR.
 
159
\fBgzip\fR(1).  See also \fBcompress\fR.
155
160
 
156
161
.TP
157
162
\fBuncompresscmd\fR
158
163
Specifies which command to use to uncompress log files.  The default is
159
 
\fBgunzip\fR.
 
164
\fBgunzip\fR(1).
160
165
 
161
166
.TP
162
167
\fBcompressext\fR
179
184
 
180
185
.TP
181
186
\fBcopytruncate\fR
182
 
Truncate the original log file in place after creating a copy,
 
187
Truncate the original log file to zero size in place after creating a copy,
183
188
instead of moving the old log file and optionally creating a new one.
184
189
It can be used when some program cannot be told to close its logfile
185
190
and thus might continue writing (appending) to the previous log file forever.
228
233
.TP
229
234
\fBextension \fIext\fR
230
235
Log files with \fIext\fR extension can keep it after the rotation. 
231
 
If compression  is  used,  the compression extension (normally \fB.gz\fR) 
 
236
If compression  is  used,  the compression extension (normally \fI.gz\fR)
232
237
appears after \fIext\fR. For example you have a logfile named mylog.foo 
233
238
and want to rotate it to mylog.1.foo.gz instead of mylog.foo.1.gz.
234
239
 
251
256
 
252
257
.TP
253
258
\fBmail \fIaddress\fR
254
 
When a log is rotated out-of-existence, it is mailed to \fIaddress\fR. If
 
259
When a log is rotated out of existence, it is mailed to \fIaddress\fR. If
255
260
no mail should be generated by a particular log, the \fBnomail\fR directive
256
261
may be used.
257
262
 
321
326
 
322
327
.TP
323
328
\fBnomail\fR
324
 
Don't mail old log files to any address.
 
329
Do not mail old log files to any address.
325
330
 
326
331
.TP
327
332
\fBnomissingok\fR
329
334
 
330
335
.TP
331
336
\fBnoolddir\fR
332
 
Logs are rotated in the same directory the log normally resides in (this 
 
337
Logs are rotated in the directory they normally reside in (this 
333
338
overrides the \fBolddir\fR option).
334
339
 
335
340
.TP
403
408
\fIsize\fR is followed by \fIk\fR, the size is assumed to be in kilobytes.
404
409
If the \fIM\fR is used, the size is in megabytes, and if \fIG\fR is used, the
405
410
size is in gigabytes. So \fBsize 100\fR, \fIsize 100k\fR, \fIsize 100M\fR and
406
 
\fIsize 100G\f are all valid.
 
411
\fIsize 100G\fR are all valid.
407
412
 
408
413
.TP
409
414
\fBsharedscripts\fR
434
439
you specify 0, the logs will be created with a .0 extension as they are
435
440
rotated from the original log files.  If you specify 9, log files will
436
441
be created with a .9, skipping 0-8.  Files will still be rotated the
437
 
number of times specified with the \fBcount\fR directive.
 
442
number of times specified with the \fBrotate\fR directive.
438
443
 
439
444
.TP
440
445
\fBtabooext\fR [+] \fIlist\fR
442
447
for information on the taboo extensions). If a + precedes the list of
443
448
extensions, the current taboo extension list is augmented, otherwise it
444
449
is replaced. At startup, the taboo extension list 
445
 
contains .rpmorig, .rpmsave, ,v, .swp, .rpmnew, ~, .cfsaved and .rhn-cfg-tmp-*.
 
450
contains .rpmorig, .rpmsave, ,v, .swp, .rpmnew, ~, .cfsaved, .rhn-cfg-tmp-*,
 
451
 .dpkg-dist, .dpkg-old, .dpkg-new, .disabled.
446
452
 
447
453
.TP
448
454
\fBweekly\fR
449
455
Log files are rotated if the current weekday is less than the weekday
450
456
of the last rotation or if more than a week has passed since the last
451
457
rotation. This is normally the same as rotating logs on the first day
452
 
of the week, but it works better if \fIlogrotate\fR is not run every
453
 
night.
 
458
of the week, but if \fBlogrotate\fR is not being run every night a log
 
459
rotation will happen at the first valid opportunity.
454
460
 
455
461
.TP
456
462
\fByearly\fR
468
474
.SH SEE ALSO
469
475
.BR gzip (1)
470
476
 
 
477
.SH NOTES
 
478
The \fBkillall\fR(1) program in Debian is found in the \fIpsmisc\fR package.
 
479
 
471
480
.SH AUTHORS
472
481
.nf
473
482
Erik Troan <ewt@redhat.com>
474
483
.nf
475
484
Preston Brown <pbrown@redhat.com>
 
485
.nf
 
486
Corrections and changes for Debian by Paul Martin <pm@debian.org>
476
487
.fi