I want to collect logs from the Windows instances in my AWS Elastic Beanstalk environment.
Short description
To collect logs from the Windows instances in your Elastic Beanstalk environment, use the AWSSupport-CollectElasticBeanstalkLogs automation. For Windows instances, use the Remote Desktop Protocol (RDP) to connect to each individual Windows instance, and then collect logs one at a time. However, you can use AWSSupport-CollectElasticBeanstalkLogs automation to collect logs from multiple Windows instances automatically to avoid this manual process.
By default, the automation uploads the log bundles for your instances as .zip files to either of the following resources:
- The default Elastic Beanstalk bucket in your account
- An Amazon Simple Storage Service (Amazon S3) bucket that you specify
The automation collects log files from the following locations:
- C:\Program Files\Amazon\ElasticBeanstalk\HealthD\Logs\*
- C:\Program Files\Amazon\ElasticBeanstalk\logs\*
- C:\cfn\log\*
- C:\inetpub\logs\*
Note: If you receive errors when running AWS Command Line Interface (AWS CLI) commands, make sure that you're using the most recent AWS CLI version.
Resolution
To run the automation, you can use the AWS Systems Manager console or AWS CLI.
AWS Systems Manager console
- Open the Systems Manager console.
- On the navigation pane, under Change Management, choose Automation.
- Choose Execute automation.
- On the Owned by Amazon tab, search for and select the AWSSupport-CollectElasticBeanstalkLogs automation document, and then choose Next.
- In the Input parameters section, enter the fields appropriate for your scenario.
- Choose Execute.
To monitor the progress of your automation, complete the following steps:
- On the navigation pane of the Systems Manager console, under Change Management, choose Automation.
- From the Execution ID column, choose your automation.
- Review the progress of your automation. The Execution steps section shows what stage the automation is currently in. The Outputs section includes logs to help you troubleshoot issues if your automation fails.
AWS CLI
1. Collect bundle logs and upload them to the default S3 bucket for Elastic Beanstalk in your account:
aws ssm start-automation-execution --document-name "AWSSupport-CollectElasticBeanstalkLogs"\
--parameters "InstanceId=INSTANCEID,\
EnvironmentId=ENVIRONMENTID,\
AutomationAssumeRole=AUTOMATIONROLE"
2. Collect bundle logs and upload them to your S3 bucket:
aws ssm start-automation-execution --document-name "AWSSupport-CollectElasticBeanstalkLogs"\
--parameters "InstanceId=INSTANCEID,\
EnvironmentId=ENVIRONMENTID,\
S3BucketName=BUCKETNAME,\
S3BucketPath=BUCKETPATH,\
AutomationAssumeRole=AUTOMATIONROLE"
3. Retrieve the execution output:
aws ssm get-automation-execution --automation-execution-id EXECUTIONID --output text --query 'AutomationExecution.Outputs'