Red Hat Bugzilla – Bug 677288
[RFE] httpd's rotatelogs needs a way to rotate files into a custom location
Last modified: 2013-07-03 00:10:44 EDT
2. What is the nature and description of the request?
Customer is looking to increase their usage of httpd's rotatelogs to replace
their current custom log rotation script, but it lacks one piece of
functionality to make that possible. They currently have a directory which
their log processing apps work out of, and to prevent any conflicts caused by
reading the currently active log file, they rotate logs into a separate
directory from where it is initially created. So for instance, they may have
apache logging to /var/log/httpd/instance1_access.log, and once the file is
rotated out it gets moved to /data/logs/instance1_access.log and their app
picks it up. They would like for rotatelogs to support doing something like
this. For example, you could pass it a flag like "rotatelogs -d /data/logs/"
that would cause it to rotate logs into that custom destinatino.
3. Why does the customer need this? (List the business requirements here)
Simplified management of log files
4. How would the customer like to achieve this? (List the functional
A flag to rotatelogs letting you specify the destination to rotate files into
5. For each functional requirement listed in question 4, specify how Red Hat
and the customer can test to confirm the requirement is successfully
Configure rotatelogs with the flag/destination and ensure that files are moved
here after being rotated out.
6. Is there already an existing RFE upstream or in Red Hat bugzilla?
7. How quickly does this need resolved? (desired target release)
earliest RHEL 5 minor release possible
8. Does this request meet the RHEL Inclusion criteria (please review)
9. List the affected packages
Comment on creeping featurism in rotatelogs as per bug 677279.
Doing a rename() on the file after rotating might be feasible to add (a trivial feature, conditional on upstream acceptance), but note that this would restrict the destination location to the same partition as the source location. Would that be acceptable to the customer? Copying a log file across partitions would mean blocking logging (and hence request processing) for unknown length of time; not really a good idea.
I've committed upstream a slightly more general way to achieve this; adding a -p argument:
from the docs:
Causes the specified program to be executed after each rotation.
Two arguments are supplied upon execution: the newly opened file and
the previous file, respectively. <code>rotatelogs</code> does not
wait for the specified program to terminate before continuing to
operate, and will not log any error code returned on termination. The
spawned program uses the same stdin, stdout, and stderr as rotatelogs
itself, and also inherits the environment.
Hopefully this will be an acceptable way to provide this enhancement.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.