Skip to content

Log cloud-init rsyslog output onto a separate file

Nacho Barrientos requested to merge cloud_output into master

Currently, cloud-init generates logs via rsyslog (output of the scripts called by it) and via the application itself. Both are at the moment being written to /var/log/cloud-init.log.

The issue is that the log format is different in those two cases, more specifically the timestamps. The application logs directly to the file using the Python logging facility, whereas rsyslog uses the standard format to create timestamps. Example (cloud-init app):

2017-10-18 09:13:52,697 - handlers.py[DEBUG]: finish: modules-config:
SUCCESS: running modules for config

and (rsylog)

Oct 18 09:14:17 localhost cloud-init: Trying to install puppet-agent
from AI repositories...

This is okay for humans but bad for computers as it makes more difficult for instace to write parsing rules to process the log files. I believe that it's reasonable to have the same time format in a single log file, hence the split.

Edited by Nacho Barrientos

Merge request reports