cloud-init should emit all of its logs to the systemd journal
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
`journalctl` is a common interface on to a system's logs, and it would be good if I could use journalctl to access cloud-init's logs in the same way I do all(/most) other units running on the system. As things stand, only some of cloud-init's logging ends up in the journal:
$ journalctl -u cloud-init.service -u cloud-final.service -u cloud-init-
164
$ wc -l /var/log/
1000 /var/log/
(This is particularly desirable when trying to line up cloud-init's logs with logs from another unit; if they were all in the journal then I could just specify -u to journalctl multiple times and get the lines in order all together. Currently, they don't even have the same logging format.)
summary: |
- cloud-init should emit its logs to the systemd journal + cloud-init should emit all of its logs to the systemd journal |
description: | updated |
Changed in cloud-init (Ubuntu): | |
status: | Confirmed → Fix Released |
Changed in cloud-init (Ubuntu): | |
status: | Fix Released → Confirmed |
I think the question is; why don't we log to syslog by default. I think historically cloud-init is run in many OSes which may or maynot have syslog capabilities so it defaults to writing it's own log directly.
At least for local testing, it's easy enough to update /etc/cloud/ cloud.d/ 05_logging. cfg
root@e1:~# diff -u /etc/cloud/ cloud.cfg. d/05_logging. cfg.orig /etc/cloud/ cloud.cfg. d/05_logging. cfg cloud.cfg. d/05_logging. cfg.orig 2019-07-26 14:14:23.950183322 +0000 cloud.cfg. d/05_logging. cfg 2019-07-26 14:14:30.110221163 +0000
--- /etc/cloud/
+++ /etc/cloud/
@@ -57,11 +57,11 @@
# that defines the configuration.
#
# If you want logs to go to syslog, uncomment the following line.
-# - [ *log_base, *log_syslog ]
+ - [ *log_base, *log_syslog ]
#
# The default behavior is to just log to a file.
# This mechanism that does not depend on a system service to operate.
- - [ *log_base, *log_file ]
+# - [ *log_base, *log_file ]
# A file path can also be used.
# - /etc/log.conf