Bug 1163020

Summary: [RFE|TRACKER] Add systemd journal/systemd support
Product: Red Hat Satellite Reporter: Lukas Zapletal <lzap>
Component: LoggingAssignee: Lukas Zapletal <lzap>
Status: CLOSED ERRATA QA Contact: Stephen Wadeley <swadeley>
Severity: low Docs Contact:
Priority: low    
Version: 6.1.0CC: bkearney, chrobert, egolov, ehelms, lzap, mvanderw, pcreech, riehecky, sthirugn
Target Milestone: 6.6.0Keywords: FutureFeature, Reopened, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/8360
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-22 12:46:40 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 Lukas Zapletal 2014-11-12 09:01:10 UTC
On RHEL7 we should leverage journald sending all the logs there for:

- foreman core app
- plugins (katello, candlepin, pulp)
- foreman proxies
- cron jobs (using systemd-cat)

When possible, we should send logging levels properly as well, so users are able to leverage fine-grained filtering system in journald (WARN, ERROR, DEBUG, TRACE).

Let's also make sure that timestamps are correctly sent and we leverage all the journald goodies.

Comment 1 RHEL Program Management 2014-11-12 09:23:34 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 Bryan Kearney 2015-04-17 18:08:21 UTC
*** Bug 1196754 has been marked as a duplicate of this bug. ***

Comment 4 Bryan Kearney 2015-08-25 18:32:36 UTC
Upstream bug component is Packaging

Comment 5 Bryan Kearney 2016-08-02 20:04:52 UTC
Upstream bug component is Packaging

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

Comment 8 Eric Helms 2016-12-16 16:31:08 UTC
Lukas,

Would you consider this BZ and https://bugzilla.redhat.com/show_bug.cgi?id=1305013 to be duplicates? If no, can you clarify the differences? If yes, can we keep the most appropriate one and close the other as a dupe.

Comment 9 Lukas Zapletal 2016-12-19 09:11:37 UTC
Yeah, I renamed this one a bit, the goal is really to send this to (a logging) daemon avoiding own logrotating/rolling/restarting.

Comment 10 Lukas Zapletal 2016-12-19 09:12:04 UTC
*** Bug 1305013 has been marked as a duplicate of this bug. ***

Comment 11 Satellite Program 2018-03-29 14:22:19 UTC
Upstream bug assigned to lzap

Comment 12 Satellite Program 2018-04-30 18:21:10 UTC
Upstream bug assigned to lzap

Comment 14 Lukas Zapletal 2018-06-25 07:47:31 UTC
Closing, we implemented this in upstream but in Satellite we are going to document and go towards integrating with rsyslog rather than with journald for 3rd party logging. Good to have the feature for the future.

Comment 17 Lukas Zapletal 2019-06-28 06:40:37 UTC
Patrick, this is just a tracker for 6.6 feature "improve common logging". I am going to slip it to ON_QA and assign Stephen here, I believe this is already VERIFIED.

Details how to set things up are: https://github.com/lzap/foreman-elasticsearch

Comment 18 Stephen Wadeley 2019-08-07 14:03:40 UTC
Hello

lzap explained to me:

by default
foreman core (rails) writes to  /var/log/foreman/production.log and smart proxy writes to /var/log/foreman-proxy/proxy.log

to use journald, which will forward logs to rsyslog and then write to /var/log/messages, you need to run:

satellite-installer --foreman-logging-level info --foreman-logging-type journald \
  --foreman-logging-layout pattern --foreman-proxy-log JOURNAL

systemctl restart httpd

NOTE

the `--foreman-logging-type journald` option installs foreman-journald

but package foreman-proxy-journald was not installed, I expected --foreman-proxy-log JOURNAL to pull it in. We can document that, raise another bug.

Before installing as above, I could 

hammer host list (to check foreman core)
tail -f /var/log/foreman/production.log
019-08-07T15:09:05 [I|app|a0ce4328] Started GET "/api/hosts?page=1&per_page=1000" for 10.37.192.23 at 2019-08-07 15:09:05 +0200
2019-08-07T15:09:05 [I|app|a0ce4328] Processing by Api::V2::HostsController#index as JSON
2019-08-07T15:09:05 [I|app|a0ce4328]   Parameters: {"page"=>"1", "per_page"=>"1000", "apiv"=>"v2", "host"=>{}}


After installing as above I could:

hammer host list (to check foreman core)
journalctl --follow
Aug 07 15:39:56 dell-r330-12.gsslab.brq.redhat.com foreman[21356]: Started GET "/api/hosts?page=1&per_page=1000" for 10.37.192.23 at 2019-08-07 15:39:56 +0200
Aug 07 15:39:56 dell-r330-12.gsslab.brq.redhat.com foreman[21356]: Processing by Api::V2::HostsController#index as JSON
Aug 07 15:39:56 dell-r330-12.gsslab.brq.redhat.com foreman[21356]:   Parameters: {"page"=>"1", "per_page"=>"1000", "apiv"=>"v2", "host"=>{}}


I also set SyncIntervalSec=10 and then did systemctl daemon-reload to reduce the wait time.

Thank you

Comment 19 Stephen Wadeley 2019-08-08 09:51:20 UTC

Bug 1738784 - foreman-proxy-log JOURNAL option should install foreman-proxy-journald

DocsBug Bug 1738850 - Logging to journald and rsyslog

Comment 21 errata-xmlrpc 2019-10-22 12:46:40 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.

https://access.redhat.com/errata/RHSA-2019:3172