Logging not working when syslog user non-existent

Bug #1172983 reported by Jacob Godin on 2013-04-26
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
cloud-init
Medium
Unassigned

Bug Description

On systems that don't have a 'syslog' user (IE CentOS), logging to /var/log/cloud-init.log does not work. I have seen the following warning:
2013-04-26 01:18:34,299 - util.py[WARNING]: Unable to change the ownership of /var/log/cloud-init.log to user syslog, group adm

It appears as though the problem is in /etc/cloud/cloud.cfg.d/05_logging.cfg:
...
# These will be joined into a string that defines the configuration
 - [ *log_base, *log_syslog ]
# These will be joined into a string that defines the configuration
 - [ *log_base, *log_file ]

A quick fix is to comment out the line with log_syslog:
# These will be joined into a string that defines the configuration
# - [ *log_base, *log_syslog ]
# These will be joined into a string that defines the configuration
 - [ *log_base, *log_file ]

This fixes the issue and logs directly to the file.

Jacob Godin (jacobgodin) wrote :

Note to the fix above: this does not remove the warning message, but does allow logging to work. Perhaps the permissions are hard-coded somewhere

Scott Moser (smoser) on 2013-04-26
Changed in cloud-init:
milestone: none → 0.7.2
Scott Moser (smoser) wrote :

Jacob,
  Can you verify that adding:
    syslog_fix_perms: null
  or
    syslog_fix_perms: $CORRECT_USER:$CORRECT_GROUP

I think you probably have to set *something* there. The reason is that early in boot (before syslog is up) cloud-init writes directly to the file as root, and then if it (later) uses syslog but the file is root:root, then syslog can't write there.

Changed in cloud-init:
status: New → Incomplete
importance: Undecided → Medium
Jacob Godin (jacobgodin) wrote :

That got rid of the error, and sends the logging into the default syslog (/var/log/messages in CentOS).

Scott Moser (smoser) wrote :

Jacob,
  cloud-init on ubuntu sends logs to /var/log/cloud-init.log because 'tools/21-cloudinit.conf' is installed into /etc/rsyslog.d/ and rsyslog is configured to read that. the redhat cloud-init.spec in trunk does something siilar, but I'm not sure if it actually has the desired affect on centos's rsyslog.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers