Where is log output from cloud-init stored?
Solution 1:
Since cloud-init
0.7.5 (released on Apr 1 2014), all output from cloud-init is captured by default to /var/log/cloud-init-output.log
. This default logging configuration was added in a commit from Jan 14 2014:
# this tells cloud-init to redirect its stdout and stderr to
# 'tee -a /var/log/cloud-init-output.log' so the user can see output
# there without needing to look on the console.
output: {all: '| tee -a /var/log/cloud-init-output.log'}
To add support for previous versions of cloud-init
, you can manually add this configuration manually to your Cloud Config Data.
Solution 2:
I couldn't find way a "native" way for doing that. Before passing the script to cloud-init, I've simply (automatically) appended a >> /tmp/init-script-log 2>&1
to each line of the script, to forward stout and stderr to a file.