Bug 1787456

Summary: [RFE] Candlepin log rotation settings should be user-configurable
Product: Red Hat Satellite Reporter: patalber
Component: CandlepinAssignee: candlepin-bugs
Status: CLOSED ERRATA QA Contact: Vladimír Sedmík <vsedmik>
Severity: high Docs Contact:
Priority: high    
Version: 6.6.0CC: bkearney, b.prins, csnyder, dsynk, jentrena, nmoumoul, pcreech, pdwyer, rvdwees
Target Milestone: 6.13.0Keywords: FutureFeature, Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: candlepin-4.2.8-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2112308 (view as bug list) Environment:
Last Closed: 2023-05-03 13:20:29 UTC Type: Bug
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: 2112308    
Bug Blocks:    

Description patalber 2020-01-02 22:45:12 UTC
1. Proposed title of this feature request  
  Candlepin log rotation settings should be user-configurable
2. What are the nature and description of the request?  
  The default settings for candlepin log rotation are too relaxed for large/busy Satellites.  As a user, I would like to be able to change the MAX_HISTORY value and that value should persist after an upgrade.
  The settings are defined in the file: /var/lib/tomcat/webapps/candlepin/WEB-INF/classes/logback.xml 
  This file is a part of the candlepin RPM, and it is not marked as a config file, so any user changes will be overwritten on RPM upgrades
  
3. Why does your organization need this? (List the business requirements here)  
  On a large/busy Satellite, 52 days of candlepin logs take up 18Gb+ of disk space. It is exceedingly unlikely to need to access logs going back this far, so the disk space is largely wasted.  This causes operational issues with filesystems filling up and impacting other parts of the Satellite server.

4. How would you like to achieve this? (List the functional requirements here)  
  Option 1: Set the logback.xml file as a noreplace-configfile in the candlepin rpm spec
  Option 2: Add an option to the satellite-installer to set the desired values
  Option 3: Any other solution that would allow a user to configure the log rotation settings for candlepin logs to persist between upgrades
  
5. For each functional requirement listed, specify how Red Hat and your organization can test to confirm the requirement is successfully implemented.  
  Make a user-defined change to the default log rotation configurations
  Validate the new setting is effective by monitoring the number of log files retained after a log rotation occurs (if changing MAX_HISTORY)
  Validate the new setting persists after an upgrade/reinstall of the candlepin RPM

6. Is there already an existing RFE upstream or in Red Hat Bugzilla?  
  No
  
7. Do you have any specific timeline dependencies and which release would they like to target (i.e. Sat 6.7, RHEL8.1)?  
  As soon as it is feasible. This becomes an operational issue for us every few weeks as we manually clean old log files

8. List any affected packages or components.  
  candlepin-2.6.9-1.el7sat.noarch

9. Would your organization be able to assist in testing this functionality if implemented?"
  Yes

Comment 4 Chris Snyder 2020-01-09 16:16:01 UTC
Would we rather implement this as requested or implement the option to have candlepin log to journalctl or rsyslog?

Comment 5 patalber 2020-01-10 16:33:03 UTC
Chris,

I will take this back to the customer and ask. As stated, it appears that they would like the option of configuring this via the installer, but they may change their minds if it is logged via journalctl or rsyslog.

Thank you for the response.

--Patrick

Comment 6 patalber 2020-01-14 15:35:25 UTC
Hi Chris,

Here is the response from the customer:

"I'm pretty un-opinionated about the mechanism that handles the log rotation.  Just glancing at the history, it looks like it was originally in logrotate then moved to logback.  As long as we can get some control over tuning the log retention policy I think it will satisfy our needs."

Looks like the method isn't as important to them as being able to control tuning of the log retention policy.

Thanks!

--Patrick

Comment 9 Mike McCune 2022-07-08 17:15:31 UTC
Upon review of our valid but aging backlog the Satellite Team has concluded that this Bugzilla does not meet the criteria for a resolution in the near term, and are planning to close in a month. This message may be a repeat of a previous update and the bug is again being considered to be closed. If you have any concerns about this, please contact your Red Hat Account team.  Thank you.

Comment 13 Vladimír Sedmík 2023-02-16 10:07:54 UTC
Verified in Satellite 6.13.0 snap 10 (candlepin-4.2.13-1.el8sat.noarch):

Option 1 (Set the logback.xml file as a noreplace-configfile in the candlepin rpm spec) was implemented as solution.

Steps to verify:
1) Downgraded candlepin to 4.1.19-1.el8sat
2) In /var/lib/tomcat/webapps/candlepin/WEB-INF/classes/logback.xml, changed the MAX_HISTORY value to 1.
3) Upgraded candlepin back to 4.2.13-1.el8sat
4) Checked the MAX_HISTORY value persisted.
5) Verified that after next logrotate no candlepin logs older than MAX_HISTORY remained in /var/log/candlepin/

Note: For more information how to set rotation of the other logs (audit.log and error.log) see https://access.redhat.com/solutions/4741091

Comment 16 errata-xmlrpc 2023-05-03 13:20:29 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 (Important: Satellite 6.13 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:2097