21.6. Enabling the oVirt Engine Extension Logger log4j

Logger implementation requires the ovirt-engine-extension-logger-log4j package. With the implementation, Red Had Virtualization Manager delegates records into log4j. Log4j is a customizable framework that provides appenders for various technologies, including SNMP and syslog.

The oVirt Engine Extension Logger log4j passes the engine.log files to an existing syslog server. The configuration procedure overlaps with Setting up a Host Logging Server.

Use this procedure on the central syslog server. You can use a separate logging server, or use this procedure to pass the engine.log files from the Manager to the syslog server.

Note

To define the syslog server for this extension, navigate to the /etc/ovirt-engine/extensions.d directory and edit the value for log4j.appender.myappender.SyslogHost in the Log4jLogger.properties file.

To define the syslog facility, navigate to the /etc/ovirt-engine/extensions.d directory and edit the value for log4j.appender.myappender.Facility in the Log4jLogger.properties file. For example, log4j.appender.myappender.Facility=local1.

Configuring the oVirt Engine Extension Logger log4j

  1. Install the extension.

    # yum install ovirt-engine-extension-logger-log4j
  2. Create the Log4jLogger.properties file in the /etc/ovirt-engine/extensions.d/ directory and include the following contents.

    ovirt.engine.extension.name = log4jlogger
    ovirt.engine.extension.provides = org.ovirt.engine.api.extensions.logger.Logger
    ovirt.engine.extension.bindings.method = jbossmodule
    ovirt.engine.extension.binding.jbossmodule.module = org.ovirt.engine-extensions.logger.log4j
    ovirt.engine.extension.binding.jbossmodule.class = org.ovirt.engineextensions.logger.log4j.Log4jLogger
    log4j.rootLogger=DEBUG, myappender
    log4j.appender.myappender=org.apache.log4j.net.SyslogAppender
    log4j.appender.myappender.SyslogHost=localhost
    log4j.appender.myappender.layout=org.apache.log4j.PatternLayout
    log4j.appender.myappender.layout.ConversionPattern=[%c] %m%n
  3. Install and configure rsyslog.

    # yum install rsyslog
  4. Configure SELinux to allow rsyslog traffic.

    # semanage port -a -t syslogd_port_t -p udp 514
  5. Edit /etc/rsyslog.conf and add the following lines:

    $template TmplAuth, "/var/log/%fromhost%/secure"
    $template TmplMsg, "/var/log/%fromhost%/messages"
    
    $RuleSet remote
    authpriv.*   ?TmplAuth
    *.info,mail.none;authpriv.none,cron.none   ?TmplMsg
    $RuleSet RSYSLOG_DefaultRuleset
    $InputUDPServerBindRuleset remote
  6. Uncomment the following two lines.

    #$ModLoad imudp
    #$UDPServerRun 514
  7. Restart the rsyslog service:

    # systemctl restart rsyslog.service
  8. If the firewall is enabled and active, run the following command to add the necessary rules for opening the rsyslog ports in Firewalld.

    # firewall-cmd --permanent --add-port=514/udp
    # firewall-cmd --reload
  9. Restart Red Hat Virtualization Manager.

    # restart ovirt-engine

The existing syslog server can now receive and store the engine.log files.