How can I collect logs from the Windows instances in my Elastic Beanstalk environment?
Last updated: 2021-06-30
I want to collect logs from the Windows instances in my AWS Elastic Beanstalk environment.
You can use the AWSSupport-CollectElasticBeanstalkLogs automation to collect logs from the Windows instances in your Elastic Beanstalk environment. For Windows instances, you must collect logs one at a time by connecting to each individual Windows instance using the Remote Desktop Protocol (RDP). However, you can avoid this manual process by using the AWSSupport-CollectElasticBeanstalkLogs automation to collect logs from multiple Windows instances automatically.
By default, the automation uploads the log bundles for your instances as .zip files to either of the following:
- The default Elastic Beanstalk bucket in the 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\*
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.
You can run the automation using the AWS Systems Manager console or AWS CLI.
1. Open the Systems Manager console.
2. On the navigation pane, in the Change Management section, choose Automation.
3. Choose Execute automation.
4. On the Owned by Amazon tab, search for and select the AWSSupport-CollectElasticBeanstalkLogs automation document, and then choose Next.
5. In the Input parameters section, enter the fields appropriate for your scenario.
6. Choose Execute.
To monitor the progress of your automation:
1. On the navigation pane of the Systems Manager console, in the Change Management section, choose Automation.
2. From the Execution ID column, choose your automation.
3. Review the progress of your automation. The Execution steps section shows what stage the automation is currently in. The Outputs section includes logs that can help you troubleshoot issues if your automation fails.
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'