Bug 1263853 - rsyslog.service unit file should contain After=network.target
rsyslog.service unit file should contain After=network.target
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: rsyslog (Show other bugs)
7.3
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Peter Vrabec
Stefan Dordevic
: EasyFix, Regression
Depends On:
Blocks: 1203710 1295396 1296594 1313485
  Show dependency treegraph
 
Reported: 2015-09-16 17:34 EDT by Ryan Sawhill
Modified: 2017-10-19 02:55 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-04 01:36:44 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ryan Sawhill 2015-09-16 17:34:23 EDT
Description of problem:

  rsyslog reads the system hostname when it starts and never thereafter. rsyslog is often used to send local logs to remote central log servers. By default, the local hostname is included in those messages.

  In environments where the local hostname is configured dynamically at boot time by DHCP or reverse-DNS, the hostname will never be set before rsyslog starts, leading to rsyslog reporting localhost.localdomain until it is restarted.

  Note that this could be considered a regression from RHEL6 behavior where rsyslog always started after networking (when using "network"; not NM). Of course the difference there is that we had a simple serialized boot order ...

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

  rsyslog ... any version, even latest in Fedora (rsyslog-8.8.0-3.fc22)

How reproducible:

  100%
  
Steps to Reproduce:

  0. systemctl enable NetworkManager-wait-online.service
  1. rm /etc/hostname
  2. Configure an interface with DHCP (from a server that provides hostnames or in a network that has good DNS PTR records for the DHCP addrs)
  3. reboot

Actual results:

  0. check /var/log/messages and see "localhost"
  1. systemctl restart rsyslog
  2. See proper transient DNS hostname as reported by hostnamectl

Expected results:

  0. grep -q After=network.target /usr/lib/systemd/system/rsyslog.service && echo TRUE (returns TRUE)
  1. Check /var/log/messages and see proper transient DNS hostname as reported by hostnamectl

Additional info:

  While rsyslog.service rightfully doesn't want/require network.target by default, many many many customers use rsyslog to send messages to / receive messages from remote systems.

Similar example: mariadb.service rightfully doesn't want/require network.target (because you can have local MySQL databases), but it DOES have "After=network.target".
  
    [root@rhel71]# rpm -Vf /usr/lib/systemd/system/mariadb.service
    [root@rhel71]# grep After /usr/lib/systemd/system/mariadb.service
    After=syslog.target
    After=network.target

  I'm not proposing we make rsyslog.service require networking; however, it SHOULD at least *try* to start after networking just like it did in RHEL6.

    [root@rhel66]# grep chkconfig /etc/init.d/{network,rsyslog}
    /etc/init.d/network:# chkconfig: 2345 10 90
    /etc/init.d/rsyslog:# chkconfig: 2345 12 88
      
    [root@rhel66]# ls -1 /etc/rc3.d/*{network,rsyslog}
    /etc/rc3.d/S10network
    /etc/rc3.d/S12rsyslog

  Note that with the change I'm proposing, it's not guaranteed we'll have a proper transient hostname by the time rsyslog starts ... unless one of the wait-online services is also enabled, along with networking itself. That's cool though. We can document that. That after all is not going to change. (See http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget)
Comment 11 errata-xmlrpc 2016-11-04 01:36:44 EDT
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://rhn.redhat.com/errata/RHEA-2016-2401.html

Note You need to log in before you can comment on or make changes to this bug.