Difference between revisions of "EKS log collector script"

From wikieduonline
Jump to navigation Jump to search
(Created page with " == See also == * {{EKS tr}} * {{EKS}} Category:EKS")
 
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
* https://github.com/awslabs/amazon-eks-ami/tree/master/log-collector-script
  
 +
[[curl -]]O https://raw.githubusercontent.com/awslabs/amazon-eks-ami/master/log-collector-script/linux/eks-log-collector.sh
 +
sudo bash eks-log-collector.sh
  
  
 +
curl -O https://raw.githubusercontent.com/awslabs/amazon-eks-ami/master/log-collector-script/linux/eks-ssm-content.json
 +
[[aws ssm create-document]] \
 +
  --name "[[EKSLogCollectorLinux]]" \
 +
  --document-type "Command" \
 +
  --content file://eks-ssm-content.json
 +
 +
[[aws ssm send-command]] \
 +
  [[--instance-ids]] <EC2 Instance ID> \
 +
  --document-name "EKSLogCollectorLinux" \
 +
  --parameters "bucketName=<S3 bucket name to push the logs>" \
 +
  --output json
 +
 +
[[aws ssm get-command-invocation]] \
 +
  --command-id "<SSM command ID>" \
 +
  --instance-id "<EC2 Instance ID>" \
 +
  --output text
 +
 +
 +
TOKEN=`[[curl -X PUT]] "http://169.254.169.254/latest/api/token" [[-H]] "X-aws-ec2-metadata-token-ttl-seconds: 21600"` \ && [[curl -H]] "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/[[user-data]]
 +
 +
== Related ==
 +
* [[SSM agent]]
 +
* <code>[[aws ec2 describe-instance]]</code>
  
 
== See also ==
 
== See also ==

Latest revision as of 11:03, 26 February 2024

curl -O https://raw.githubusercontent.com/awslabs/amazon-eks-ami/master/log-collector-script/linux/eks-log-collector.sh
sudo bash eks-log-collector.sh


curl -O https://raw.githubusercontent.com/awslabs/amazon-eks-ami/master/log-collector-script/linux/eks-ssm-content.json
aws ssm create-document \
 --name "EKSLogCollectorLinux" \
 --document-type "Command" \
 --content file://eks-ssm-content.json
aws ssm send-command \
  --instance-ids <EC2 Instance ID> \
  --document-name "EKSLogCollectorLinux" \
  --parameters "bucketName=<S3 bucket name to push the logs>" \
  --output json
aws ssm get-command-invocation \
  --command-id "<SSM command ID>" \
  --instance-id "<EC2 Instance ID>" \
  --output text


TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` \ && curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/user-data

Related[edit]

See also[edit]

Advertising: