Bug 1738850

Summary: Logging to journald and rsyslog
Product: Red Hat Satellite Reporter: Stephen Wadeley <swadeley>
Component: DocumentationAssignee: Sergei Petrosian <spetrosi>
Status: CLOSED CURRENTRELEASE QA Contact: Vlada Grosu <vgrosu>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.6.0CC: lzap, spetrosi
Target Milestone: UnspecifiedKeywords: Reopened
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-23 14:03:47 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:

Description Stephen Wadeley 2019-08-08 09:43:12 UTC
Document URL: 

https://access.redhat.com/documentation/en-us/red_hat_satellite/6.5/html/administering_red_hat_satellite/chap-red_hat_satellite-administering_red_hat_satellite-logging_and_reporting_problems

Section Number and Name:

Chapter 12. Logging and Reporting Problems

Describe the issue: 

This part is potentially misleading because foreman components do not log to systemd-journald by default and the text is only true for the RHEL7 base system:

“On Red Hat Enterprise Linux 7, you can use the journal for more extensive logging information. For more information, see Using the Journal in the Red Hat Enterprise Linux 7 System Administrator’s guide.”

In Satellite 6.6, some components now support logging to journald and rsyslog.

Suggestions for improvement: 

We should remove the first sentence:
On Red Hat Enterprise Linux 7, you can use the journal for more extensive logging information.

 and then add this before the second sentence with the link:

In Satellite 6.6, foreman and foreman proxy can be configured to log to journald which will forward the log messages to rsyslog for further processing. There is a default 5 minute delay configurable using journald’s SyncIntervalSec directive. Rsyslog will write the log messages to /var/log/messages, and the log messages will no longer appear in /var/log/foreman/production.log or /var/log/foreman-poxy.log.

To enable logging to journald and rsyslog:

Until Red Hat Bug 1738784 is resolved, the ` foreman-proxy-journald` package must be installed manually :
~~~
~]# yum install foreman-proxy-journald
~~~

Run the installer script to configure logging to journald:
~~~
~]# satellite-installer --foreman-logging-level info --foreman-logging-type journald \
  --foreman-logging-layout pattern --foreman-proxy-log JOURNAL
~~~

Restart apache daemon:
~~~
~]# systemctl restart httpd
~~~

The sentence with the link can be last para, but also change s/For more information/For more information on jounrald/

Additional information: 


I notice that this table :
Table 12.1. Log Files for Reporting and Troubleshooting

Does not mention /var/log/foreman/production.log

Re “Edit the /etc/foreman/settings.yaml file. “

We should mention that is temporary change, running the installer again will change it. For a permanent change it is best to use the installer.

-----------------------------------------------------------------------------------------


We should mention somewhere how to get “full help” for logging options:

[root@dell-r330-12 ~]# foreman-installer --full-help | grep logging
    --foreman-logging-layout      Logging layout of the Foreman application (current: "pattern")
    --reset-foreman-logging-layout Reset logging_layout to the default value ("pattern")
    --foreman-logging-level       Logging level of the Foreman application (current: "info")
    --reset-foreman-logging-level Reset logging_level to the default value ("info")
    --foreman-logging-type        Logging type of the Foreman application (current: "journald")
    --reset-foreman-logging-type  Reset logging_type to the default value ("file")
    --foreman-proxy-content-qpid-router-logging  Whether to log to file or syslog. (current: "syslog")
    --reset-foreman-proxy-content-qpid-router-logging Reset qpid_router_logging to the default value ("syslog")
    --foreman-proxy-content-qpid-router-logging-level  Logging level of dispatch router (e.g. info+ or debug+) (current: "info+")
    --reset-foreman-proxy-content-qpid-router-logging-level Reset qpid_router_logging_level to the default value ("info+")
    --foreman-proxy-content-qpid-router-logging-path  Directory for dispatch router logs, if using file logging (current: "/var/log/qdrouterd")
    --reset-foreman-proxy-content-qpid-router-logging-path Reset qpid_router_logging_path to the default value ("/var/log/qdrouterd")
    --puppet-syslogfacility       Facility name to use when logging to syslog (current: UNDEF)

its much more than the normal help:

[root@dell-r330-12 ~]# foreman-installer --help | grep logging
    --puppet-syslogfacility       Facility name to use when logging to syslog (current: UNDEF)
[root@dell-r330-12 ~]#

Comment 1 Stephen Wadeley 2019-08-08 09:46:19 UTC
FYI

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

Bug 1623090 - Setting --foreman-logging-level via installer doesn't affect the log level of /var/log/foreman/production.log

Comment 2 Sergei Petrosian 2019-08-08 09:50:22 UTC
Hi Stephen, thank you for raising this bug.

Comment 8 Lukas Zapletal 2019-08-16 11:09:53 UTC
Hello, you are in shell so you must escape quotes I think:

--foreman-loggers "{\"sql\" => true}"

Comment 9 Sergei Petrosian 2019-08-16 11:32:38 UTC
(In reply to Lukas Zapletal from comment #8)
> Hello, you are in shell so you must escape quotes I think:
> 
> --foreman-loggers "{\"sql\" => true}"

Hi Lukas, does it work for you? My Satellite throwing the following error:
~~~~
# satellite-installer --foreman-loggers "{\"sql\" => true}"
Resetting puppet server version param...
Parameter foreman-loggers invalid: Hash value elements are invalid: nil is not a valid boolean
Error during configuration, exiting
~~~~

Thank you

Comment 10 Stephen Wadeley 2019-08-16 12:36:39 UTC
[root@dell-r330-12 ~]# satellite-installer --foreman-loggers {\"sql\" => true}
ERROR: too many arguments

See: 'satellite-installer --help'
[root@dell-r330-12 ~]# satellite-installer --foreman-loggers "{\"sql\" => true}"
Parameter foreman-loggers invalid: Hash value elements are invalid: nil is not a valid boolean
Error during configuration, exiting
[root@dell-r330-12 ~]#

Comment 11 Lukas Zapletal 2019-08-19 06:57:40 UTC
Hello, I haven't tried but I think it must be JSON, that would be:

# satellite-installer --foreman-loggers "{\"sql\": true}"

Try that, if that's correct then file an installer bug that the help is incorrect.

Comment 12 Sergei Petrosian 2019-08-19 08:53:23 UTC
Hi Lukas,

this does not work either:

# satellite-installer --foreman-loggers "{\"sql\": true}"
Resetting puppet server version param...
Parameter foreman-loggers invalid: Hash value elements are invalid: " true}Error during configuration, exiting

Will open a bug for installer now

Comment 13 Sergei Petrosian 2019-08-19 09:01:55 UTC
I opened BZ#1743165 to fix this.

Comment 19 Sergei Petrosian 2019-08-20 12:07:28 UTC
These changes are live on the 6.6-beta branch and ready to be published with 6.6 Beta documentation.

Comment 20 Sergei Petrosian 2019-08-22 08:48:34 UTC
As per Ewoud's BZ#1743165 comment#5, the correct satellite-installer command to enable and disable individual loggers is in the form "satellite-installer --foreman-loggers sql:true". I tested this command and it works perfectly.

I am reopening this to change the procedure that tells to edit files manually to use commands for better user-experience.