Bug 677288

Summary: [RFE] httpd's rotatelogs needs a way to rotate files into a custom location
Product: Red Hat Enterprise Linux 5 Reporter: J.H.M. Dassen (Ray) <rdassen>
Component: httpdAssignee: Joe Orton <jorton>
Status: CLOSED ERRATA QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: low Docs Contact:
Priority: low    
Version: 5.6CC: bgollahe, dapospis, jkaluza, jruemker, rbinkhor
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
: 757735 (view as bug list) Environment:
Last Closed: 2012-02-21 06:33:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 554476, 726419, 757735, 769266    

Description J.H.M. Dassen (Ray) 2011-02-14 09:20:34 UTC
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
requirements here)

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
implemented.

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?

No

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)

Yes

9. List the affected packages

httpd

Comment 2 Joe Orton 2011-02-14 11:46:00 UTC
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.

Comment 5 Joe Orton 2011-06-20 10:48:13 UTC
I've committed upstream a slightly more general way to achieve this; adding a -p argument:

   https://svn.apache.org/viewvc?view=revision&revision=1137590

from the docs:

""
-p <program>

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.

Comment 10 errata-xmlrpc 2012-02-21 06:33:50 UTC
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.

http://rhn.redhat.com/errata/RHBA-2012-0261.html