Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Write detailed output from bootstrap.sh to log file #1183

Closed
jebbens opened this issue Feb 14, 2023 · 4 comments
Closed

feat: Write detailed output from bootstrap.sh to log file #1183

jebbens opened this issue Feb 14, 2023 · 4 comments

Comments

@jebbens
Copy link

jebbens commented Feb 14, 2023

What would you like to be added:
Write detailed output from bootstrap.sh to a log file, e.g.

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

Needs to be done in a way that does not overwrite user-provided user-data from custom launch template.

Why is this needed:
When dealing with custom launch templates, e.g. to configure for use with a proxy, it is useful to have the complete output of all user data in a log file for troubleshooting.

@jebbens jebbens changed the title feat: Write output from bootstrap.sh to log file feat: Write detailed output from bootstrap.sh to log file Feb 14, 2023
@cartermckinnon
Copy link
Member

cartermckinnon commented Feb 16, 2023

The bootstrap logs should already be present in /var/log/cloud-init-output.log, but adding more details (in a more uniform format) sounds like a great idea to me. Is there any information in particular you're looking for?

@jebbens
Copy link
Author

jebbens commented Feb 16, 2023

I don't see very much in cloud-init-output.log. I think if we added the two lines of code I referenced above (per recommendation from here, we'd get more useful output. Also, if a user provides their own user-data in a different MIME message part that runs before the bootstrap.sh, and outputs it to that same file, it may get overwritten by the user-data behind it (if it writes to the same file). So, we could output logs from bootstrap.sh to a separate file, e.g. /var/log/bootstrap.log to avoid that conflict.

@cartermckinnon
Copy link
Member

Any stdout from user data will appear in cloud-init-output.log. We recently added more logging to the bootstrap script, so I'm going to close this issue. Let me know if #1276 doesn't meet your needs.

@jebbens
Copy link
Author

jebbens commented May 25, 2023

Looking at nodes I just launched, my cloud-init-output.log looks nothing like my user-data.log. All i see in the former is a short log of network interfaces and routing information. Not sure why I'm not seeing all of the output from the user-data that I see in the latter. Note these are self-managed nodes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants