Bug 1305013

Summary: [RFE] Configure Satellite 6 Rails app with syslog by default
Product: Red Hat Satellite Reporter: Christian Horn <chorn>
Component: PackagingAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1.4CC: bbuckingham, ehelms, lzap, sthirugn, xdmoon
Target Milestone: UnspecifiedKeywords: FutureFeature, Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
URL: http://projects.theforeman.org/issues/13702
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-19 09:12:04 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: 1296845    

Description Christian Horn 2016-02-05 10:30:16 UTC
Description of problem:
2 logrotate tools beeing active on /var/log/foreman logfiles:

/var/log/foreman seems to be cared for by 2 mechanisms:
logrotate and a ruby mechanism, this looks like this:

[root@rhel7-sat-61 foreman]# ll /var/log/foreman
[...]
-rw-r--r--. 1 foreman foreman      0 12月 13 03:50 production.20151211.log
-rw-r--r--. 1 foreman foreman  40359 12月 13 03:50 production.20151211.log-20151213
-rw-rw-r--. 1 foreman foreman  86701 12月 17 07:07 production.log
-rw-rw-r--. 1 foreman foreman   7196 12月  4 03:09 production.log-20151204.gz
-rw-rw-r--. 1 foreman foreman   7303 12月  5 03:39 production.log-20151205.gz
[...]

Version-Release number of selected component (if applicable):
current 6.1

How reproducible:
always

Steps to Reproduce:
1. ls -al /var/log/foreman

Actual results:
More than one mechanism is caring for the logfiles: ruby internal and "logrotate".

Expected results:
The ruby internal mechanism should be disabled.

Additional info:
- reported in upstream http://projects.theforeman.org/issues/13499

Comment 1 Christian Horn 2016-02-05 10:31:14 UTC
Foreman is using the default Rails logging infrastructure 
to log to "log/#{Rails.env}.log" 
(see /opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.8/lib/rails/application/configuration.rb).
Rails is using the "logging" gem for that, as defined in
/opt/rh/ruby193/root/usr/share/gems/gems/logging-1.8.1/lib/logging.rb which says:
      appender =
          case dev
          when String
            ::Logging::Appenders::RollingFile.new(name, a_opts)
          else
            ::Logging::Appenders::IO.new(name, dev, a_opts)
          end

(dev being the device/filename to log to). As we are passing 
"log/#{Rails.env}.log", logging uses the RollingFile appender, 
which is defined in "/opt/rh/ruby193/root/usr/share/gems/gems/logging-1.8.1/lib/logging/appenders/rolling_file.rb". 
While I cannot find where the configuration for this is done 
(nobody defines the "age" and "roll_by" params needed), the 
file-naming we see is exactly the one from RollingFile: 
          @logname_fmt = "#{bn}.%Y%m%d#{ext}"
and we also see a production.log.age file in /var/log/foreman.

Comment 3 Lukas Zapletal 2016-02-15 09:39:10 UTC
Instead trying to fix file appenders, I think the proper solution is to finally configure Satellite 6 with syslog/journald. We are tracking this for some time already, recent changes in upstream allows this.

Triage notes: Not yet implemented upstream, we are tracking this.

Comment 4 Lukas Zapletal 2016-02-15 09:40:38 UTC
Additional note: To make this clear, the app is ready, we just need to configure it properly in the packages. Easy task, not sure if we can hit 6.2 tho.

Comment 6 Bryan Kearney 2016-07-26 20:12:21 UTC
Upstream bug component is Packaging

Comment 7 Bryan Kearney 2016-08-02 20:12:21 UTC
Upstream bug component is Packaging

Comment 9 Bryan Kearney 2016-08-04 20:19:19 UTC
Moving 6.2 bugs out to sat-backlog.

Comment 10 Bryan Kearney 2016-12-16 18:03:33 UTC
Upstream bug component is Packaging

Comment 11 Lukas Zapletal 2016-12-19 09:12:04 UTC

*** This bug has been marked as a duplicate of bug 1163020 ***