Log AWS user data to console

It’s very useful to see the logs of your user data in the console. Especially if you can’t get into the Linux instance.

Just add this at the top of your user data

exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1

Source

https://aws.amazon.com/premiumsupport/knowledge-center/ec2-linux-log-user-data/

Published by

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.