|
|
9b6d9a |
From 24a473e10883cf61278eb8a64876ebf9e2cfbdc4 Mon Sep 17 00:00:00 2001
|
|
|
9b6d9a |
From: jkaluza <jkaluza@ec1272ba-9ed1-42ef-8245-99669996828e>
|
|
|
9b6d9a |
Date: Wed, 15 Oct 2014 13:22:23 +0000
|
|
|
9b6d9a |
Subject: [PATCH] Backport debian manpage and mktime patches
|
|
|
9b6d9a |
|
|
|
9b6d9a |
Upstream-commit: 9c68d75c729b926e2c70bc579a12e58e472abf57
|
|
|
9b6d9a |
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
|
9b6d9a |
---
|
|
|
9b6d9a |
logrotate.8 | 40 ++++++++++++++++++++++------------------
|
|
|
9b6d9a |
logrotate.c | 2 ++
|
|
|
9b6d9a |
2 files changed, 24 insertions(+), 18 deletions(-)
|
|
|
9b6d9a |
|
|
|
9b6d9a |
diff --git a/logrotate.8 b/logrotate.8
|
|
|
9b6d9a |
index e48dd0b..7d93eb9 100644
|
|
|
9b6d9a |
--- a/logrotate.8
|
|
|
9b6d9a |
+++ b/logrotate.8
|
|
|
9b6d9a |
@@ -11,8 +11,8 @@ removal, and mailing of log files. Each log file may be handled daily,
|
|
|
9b6d9a |
weekly, monthly, or when it grows too large.
|
|
|
9b6d9a |
.P
|
|
|
9b6d9a |
Normally, \fBlogrotate\fR is run as a daily cron job. It will not modify
|
|
|
9b6d9a |
-a log multiple times in one day unless the criterion for that log is
|
|
|
9b6d9a |
-based on the log's size and \fBlogrotate\fR is being run multiple times
|
|
|
9b6d9a |
+a log more than once in one day unless the criterion for that log is
|
|
|
9b6d9a |
+based on the log's size and \fBlogrotate\fR is being run more than once
|
|
|
9b6d9a |
each day, or unless the \fB\-f\fR or \fB\-\-force\fR option is used.
|
|
|
9b6d9a |
.P
|
|
|
9b6d9a |
Any number of config files may be given on the command line. Later config
|
|
|
9b6d9a |
@@ -68,7 +68,7 @@ Prints a short usage message.
|
|
|
9b6d9a |
|
|
|
9b6d9a |
.TP
|
|
|
9b6d9a |
+\fB\-v\fR, \fB\-\-verbose\fR
|
|
|
9b6d9a |
-Turns on verbose mode.
|
|
|
9b6d9a |
+Turns on verbose mode, ie. display messages during rotation.
|
|
|
9b6d9a |
|
|
|
9b6d9a |
.SH CONFIGURATION FILE
|
|
|
9b6d9a |
|
|
|
9b6d9a |
@@ -120,9 +120,9 @@ compress
|
|
|
9b6d9a |
The first few lines set global options; in the example, logs are
|
|
|
9b6d9a |
compressed after they are rotated. Note that comments may appear
|
|
|
9b6d9a |
anywhere in the config file as long as the first non-whitespace
|
|
|
9b6d9a |
-character on the line is a #.
|
|
|
9b6d9a |
+character on the line is a \fB#\fR.
|
|
|
9b6d9a |
|
|
|
9b6d9a |
-The next section of the config files defined how to handle the log file
|
|
|
9b6d9a |
+The next section of the config file defines how to handle the log file
|
|
|
9b6d9a |
\fI/var/log/messages\fR. The log will go through five weekly rotations before
|
|
|
9b6d9a |
being removed. After the log file has been rotated (but before the old
|
|
|
9b6d9a |
version of the log has been compressed), the command
|
|
|
9b6d9a |
@@ -130,14 +130,15 @@ version of the log has been compressed), the command
|
|
|
9b6d9a |
|
|
|
9b6d9a |
The next section defines the parameters for both
|
|
|
9b6d9a |
\fI/var/log/httpd/access.log\fR and \fI/var/log/httpd/error.log\fR.
|
|
|
9b6d9a |
-They are rotated whenever it grows over 100k in size, and the old logs
|
|
|
9b6d9a |
+Each is rotated whenever it grows over 100k in size, and the old logs
|
|
|
9b6d9a |
files are mailed (uncompressed) to www@my.org after going through 5
|
|
|
9b6d9a |
rotations, rather than being removed. The \fBsharedscripts\fR means that
|
|
|
9b6d9a |
the \fBpostrotate\fR script will only be run once (after the old logs have
|
|
|
9b6d9a |
-been compressed), not once for each log which is rotated. Note that the double
|
|
|
9b6d9a |
-quotes around the first filename at the beginning of this section allows
|
|
|
9b6d9a |
-logrotate to rotate logs with spaces in the name. Normal shell quoting rules
|
|
|
9b6d9a |
-apply, with ', ", and \\ characters supported.
|
|
|
9b6d9a |
+been compressed), not once for each log which is rotated.
|
|
|
9b6d9a |
+Note that log file names may be enclosed in
|
|
|
9b6d9a |
+quotes (and that quotes are required if the name contains spaces).
|
|
|
9b6d9a |
+Normal shell quoting rules apply, with \fB'\fR, \fB"\fR, and \fB\\\fR
|
|
|
9b6d9a |
+characters supported.
|
|
|
9b6d9a |
|
|
|
9b6d9a |
The next section defines the parameters for all of the files in
|
|
|
9b6d9a |
\fI/var/log/news\fR. Each file is rotated on a monthly basis. This is
|
|
|
9b6d9a |
@@ -163,12 +164,12 @@ Old versions of log files are compressed with \fBgzip\fR(1) by default. See also
|
|
|
9b6d9a |
.TP
|
|
|
9b6d9a |
\fBcompresscmd\fR
|
|
|
9b6d9a |
Specifies which command to use to compress log files. The default is
|
|
|
9b6d9a |
-\fBgzip\fR. See also \fBcompress\fR.
|
|
|
9b6d9a |
+\fBgzip\fR(1). See also \fBcompress\fR.
|
|
|
9b6d9a |
|
|
|
9b6d9a |
.TP
|
|
|
9b6d9a |
\fBuncompresscmd\fR
|
|
|
9b6d9a |
Specifies which command to use to uncompress log files. The default is
|
|
|
9b6d9a |
-\fBgunzip\fR.
|
|
|
9b6d9a |
+\fBgunzip\fR(1).
|
|
|
9b6d9a |
|
|
|
9b6d9a |
.TP
|
|
|
9b6d9a |
\fBcompressext\fR
|
|
|
9b6d9a |
@@ -195,7 +196,7 @@ as the old log file stays in place.
|
|
|
9b6d9a |
|
|
|
9b6d9a |
.TP
|
|
|
9b6d9a |
\fBcopytruncate\fR
|
|
|
9b6d9a |
-Truncate the original log file in place after creating a copy,
|
|
|
9b6d9a |
+Truncate the original log file to zero size in place after creating a copy,
|
|
|
9b6d9a |
instead of moving the old log file and optionally creating a new one.
|
|
|
9b6d9a |
It can be used when some program cannot be told to close its logfile
|
|
|
9b6d9a |
and thus might continue writing (appending) to the previous log file forever.
|
|
|
9b6d9a |
@@ -266,7 +267,7 @@ and thus might continue writing to the previous log file for some time.
|
|
|
9b6d9a |
.TP
|
|
|
9b6d9a |
\fBextension \fIext\fR
|
|
|
9b6d9a |
Log files with \fIext\fR extension can keep it after the rotation.
|
|
|
9b6d9a |
-If compression is used, the compression extension (normally \fB.gz\fR)
|
|
|
9b6d9a |
+If compression is used, the compression extension (normally \fI.gz\fR)
|
|
|
9b6d9a |
appears after \fIext\fR. For example you have a logfile named mylog.foo
|
|
|
9b6d9a |
and want to rotate it to mylog.1.foo.gz instead of mylog.foo.1.gz.
|
|
|
9b6d9a |
|
|
|
9b6d9a |
@@ -293,7 +294,7 @@ the taboo extensions, as specified by the \fBtabooext\fR directive.
|
|
|
9b6d9a |
|
|
|
9b6d9a |
.TP
|
|
|
9b6d9a |
\fBmail \fIaddress\fR
|
|
|
9b6d9a |
-When a log is rotated out-of-existence, it is mailed to \fIaddress\fR. If
|
|
|
9b6d9a |
+When a log is rotated out of existence, it is mailed to \fIaddress\fR. If
|
|
|
9b6d9a |
no mail should be generated by a particular log, the \fBnomail\fR directive
|
|
|
9b6d9a |
may be used.
|
|
|
9b6d9a |
|
|
|
9b6d9a |
@@ -377,7 +378,7 @@ Do not archive old versions of log files with date extension
|
|
|
9b6d9a |
|
|
|
9b6d9a |
.TP
|
|
|
9b6d9a |
\fBnomail\fR
|
|
|
9b6d9a |
-Don't mail old log files to any address.
|
|
|
9b6d9a |
+Do not mail old log files to any address.
|
|
|
9b6d9a |
|
|
|
9b6d9a |
.TP
|
|
|
9b6d9a |
\fBnomissingok\fR
|
|
|
9b6d9a |
@@ -385,7 +386,7 @@ If a log file does not exist, issue an error. This is the default.
|
|
|
9b6d9a |
|
|
|
9b6d9a |
.TP
|
|
|
9b6d9a |
\fBnoolddir\fR
|
|
|
9b6d9a |
-Logs are rotated in the same directory the log normally resides in (this
|
|
|
9b6d9a |
+Logs are rotated in the directory they normally reside in (this
|
|
|
9b6d9a |
overrides the \fBolddir\fR option).
|
|
|
9b6d9a |
|
|
|
9b6d9a |
.TP
|
|
|
9b6d9a |
@@ -515,7 +516,10 @@ number of times specified with the \fBrotate\fR directive.
|
|
|
9b6d9a |
\fBsu \fIuser\fR \fIgroup\fR
|
|
|
9b6d9a |
Rotate log files set under this user and group instead of using default
|
|
|
9b6d9a |
user/group (usually root). \fIuser\fR specifies the user name used for
|
|
|
9b6d9a |
-rotation and \fIgroup\fR specifies the group used for rotation.
|
|
|
9b6d9a |
+rotation and \fIgroup\fR specifies the group used for rotation. If the
|
|
|
9b6d9a |
+user/group you specify here does not have sufficient privilege to make
|
|
|
9b6d9a |
+files with the ownership you've specified in a \fIcreate\fR instruction,
|
|
|
9b6d9a |
+it will cause an error.
|
|
|
9b6d9a |
|
|
|
9b6d9a |
.TP
|
|
|
9b6d9a |
\fBtabooext\fR [+] \fIlist\fR
|
|
|
9b6d9a |
diff --git a/logrotate.c b/logrotate.c
|
|
|
9b6d9a |
index e056ccd..fabfde9 100644
|
|
|
9b6d9a |
--- a/logrotate.c
|
|
|
9b6d9a |
+++ b/logrotate.c
|
|
|
9b6d9a |
@@ -2279,12 +2279,14 @@ static int readState(char *stateFilename)
|
|
|
9b6d9a |
return 1;
|
|
|
9b6d9a |
}
|
|
|
9b6d9a |
|
|
|
9b6d9a |
+ memset(&st->lastRotated, 0, sizeof(st->lastRotated));
|
|
|
9b6d9a |
st->lastRotated.tm_year = year;
|
|
|
9b6d9a |
st->lastRotated.tm_mon = month;
|
|
|
9b6d9a |
st->lastRotated.tm_mday = day;
|
|
|
9b6d9a |
st->lastRotated.tm_hour = hour;
|
|
|
9b6d9a |
st->lastRotated.tm_min = minute;
|
|
|
9b6d9a |
st->lastRotated.tm_sec = second;
|
|
|
9b6d9a |
+ st->lastRotated.tm_isdst = -1;
|
|
|
9b6d9a |
|
|
|
9b6d9a |
/* fill in the rest of the st->lastRotated fields */
|
|
|
9b6d9a |
lr_time = mktime(&st->lastRotated);
|
|
|
9b6d9a |
--
|
|
|
9b6d9a |
2.14.3
|
|
|
9b6d9a |
|