Where to find logs for a cloud-init user-data script?

cbare picture cbare · Sep 9, 2013 · Viewed 35.7k times · Source

I'm initializing spot instances running a derivative of the standard Ubuntu 13.04 AMI by pasting a shell script into the user-data field.

This works. The script runs. But it's difficult to debug because I can't figure out where the output of the script is being logged, if anywhere.

I've looked in /var/log/cloud-init.log, which seems to contain a bunch of stuff that would be relevant to debugging cloud-init, itself, but nothing about my script. I grepped in /var/log and found nothing.

Is there something special I have to do to turn logging on?

Answer

mikemaccana picture mikemaccana · Jan 31, 2018

The default location for cloud init user data is already /var/log/cloud-init-output.log, in AWS, DigitalOcean and most other cloud providers. You don't need to set up any additional logging to see the output.