Skip to content

Include user-data in log collection bundle#1274

Closed
cartermckinnon wants to merge 1 commit intomasterfrom
collect-user-data
Closed

Include user-data in log collection bundle#1274
cartermckinnon wants to merge 1 commit intomasterfrom
collect-user-data

Conversation

@cartermckinnon
Copy link
Copy Markdown
Contributor

Description of changes:

Diagnosing issues with node bootstrapping almost always requires the details of the user-data. This eliminates a round-trip email in the support cycle.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Copy Markdown
Contributor

@dims dims left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

else
warning "Unable to find EC2 user-data, skipping."
fi
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it is safe to echo without handling special case?

I think it would be better with base64 / base64 -d, WDYT?

Test results:

[root@ip-XXX ~]# rm -vf user-data.txt
removed ‘user-data.txt’
[root@ip-XXX ~]# cat test.sh
#!/usr/bin/env bash

IMDS_TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 360")

if USER_DATA_BASE64=$(curl -H "X-aws-ec2-metadata-token: $IMDS_TOKEN" -f -s --max-time 10 --retry 5 http://169.254.169.254/latest/user-data | base64); then
  echo "${USER_DATA_BASE64}" | base64 -d > user-data.txt
else
  # changed "warning" to "echo" for test
  echo "Unable to find EC2 user-data, skipping."
fi
[root@ip-XXX ~]# ./test.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    56  100    56    0     0   6820      0 --:--:-- --:--:-- --:--:--  7000
[root@ip-XXX ~]# cat user-data.txt
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="//"

... (omit)

@cartermckinnon cartermckinnon deleted the collect-user-data branch August 31, 2023 18:52
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

Successfully merging this pull request may close these issues.

3 participants