Correct hostname not displayed in syslog after boot

Bug #1599810 reported by Dan Watkins
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
cloud-images
New
Undecided
Unassigned
cloud-init (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

rsyslog will use the hostname that an instance had when it started when logging messages (unless it's `kill -HUP`'d). When a cloud image boots, it has the generic hostname of "ubuntu", which means that all syslog messages are for the "ubuntu" host until rsyslog restarts, or log rotation happens.

Revision history for this message
Dan Watkins (oddbloke) wrote :

I've marked this as affecting cloud-init; I'd be interested to hear smoser's opinion on how he thinks this would best be fixed. (I think he's on vacation this week, so it'll have to wait a few days)

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in cloud-init (Ubuntu):
status: New → Confirmed
Revision history for this message
Scott Moser (smoser) wrote :

Can you explain where you see this ?

Just in /var/log.cloud-init.log or elsewhere ?
Its interesting because at the momemnt i'm leaning towards making cloud-init not log through rsyslog unless instructed to.

https://code.launchpad.net/~harlowja/cloud-init/+git/cloud-init/+merge/301729

Revision history for this message
Ingo Gottwald (in-gottwald) wrote :

I originally saw this in /var/log/syslog of all my GCE machines that were built on-top of ubuntu-1604-xenial-v20160610 and older.
See also this bug-report: https://github.com/GoogleCloudPlatform/compute-image-packages/issues/290

I'm now running machines off the image ubuntu-1604-xenial-v20160907a where I can't reproduce the problem any more.

Revision history for this message
Ingo Gottwald (in-gottwald) wrote :

OK, maybe I was too quick on this one.
Just did a test with ubuntu-1604-xenial-v20161013 in GCE.

To reproduce, simply boot up a machine from that image and look at the /var/log/syslog.
The hostname in the log says "ubuntu" instead of the real machine hostname.

Sending a testlog with "logger testlog1" gives me this line in /var/log/syslog:
Oct 18 08:20:22 ubuntu igottwald: testlog 1

After that I do a "sudo pkill -HUP rsyslogd" and write another testlog with "logger testlog 2", then I see in /var/log/syslog:
Oct 18 08:26:32 test-ig1 igottwald: testlog 2

test-ig1 is the correct hostname.

Same is true if you build images with packer on-top of this image. The resulting images start with a hostname in the log which looks like "packer-bc6a04da-56ea-4982-aed6-664877993834" since this is the method of packer choosing random hostnames during image build.
Again once the rsyslogd is HUPed or restarted, the correct hostname is back again.

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.