Bug 1034907

Summary: production.log does not rotate
Product: [Retired] Subscription Asset Manager Reporter: Chris Duryee <cduryee>
Component: katelloAssignee: Katello Bug Bin <katello-bugs>
Status: CLOSED WONTFIX QA Contact: SAM QE List <sam-qe-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 1.3CC: bkearney, jsherril, xdmoon
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-30 13:44:55 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:    
Bug Blocks: 971511    

Description Chris Duryee 2013-11-26 17:01:20 UTC
Description of problem:

If a user has a SAM instance that has been running for awhile (either 1 week or 2 weeks, not sure yet), proudction.log will not get rolled and will get stuck. Logs will look like this:

]# ls -ltrh /var/log/katello/production.log*
-rw-r--r--. 1 root    root     0 Nov 26 10:34 /var/log/katell/production.log.age
-rw-r-----. 1 katello katello 88 Nov 26 10:38 /var/log/katello/production.log._copy_
-rw-r-----. 1 katello katello  0 Nov 26 10:38 /var/log/katello/production.log

Note the zero-byte production.log

Version-Release number of selected component (if applicable): sam 1.3


How reproducible: every time

Steps to Reproduce:
1. set up sam
2. do something that causes output to production.log
3. wait for rotate to happen (1 week by default)
4. do something else to cause output to production.log

Actual results:

production.log will be zero-byte and will not get updates at this point. This makes it difficult to debug other issues, especially katello-debug output.

Expected results:

production.log gets rolled successfully


Additional info:

I suspect that when katello-configure runs, it creates a production.log.age file as root. However, katello runs as katello user, so it cannot clear out this file when performing a log rotation.

Here is a way to repro without waiting a week:

* set up SAM as usual, running katello-configure
* edit /usr/share/katello/config/katello_defaults.yml, change "age: 'weekly'" to "age: 30", which will rotate every 30 sec
* bounce katello
* start up rails console as katello user (sudo su - katello -s /bin/bash, then start console)
* Rails.logger.warn("foo")
* wait 30+ sec for log to rotate
* Rails.logger.warn("foofoo")
* quit console
* check production.log, foofoo message will not appear

This command appears to work around the issue:

chown katello.katello /var/log/katello/production.log.age

Comment 1 Xixi 2013-12-04 04:18:03 UTC
KCS solution in Knowledgebase: https://access.redhat.com/site/solutions/633103

Comment 2 Chris Duryee 2016-11-30 13:44:55 UTC
closing out older bug, any new implementation would very likely not hit this.

I am marking as closed/wontfix, but feel free to re-open if needed.