AWS Elastic Beanstalk
Developer Guide (API Version 2010-12-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Working with Logs

You can access logs from the Amazon EC2 instances running your applications. There are two ways to do this:

  • Snapshot the logs and view them in the Elastic Beanstalk console.

  • Configure your environment to automatically publish logs to an S3 bucket.

This topic explains how to access your logs using both methods.

Viewing Log Snapshots in the Elastic Beanstalk Console

To take a snapshot and view logs

  1. Open the AWS Elastic Beanstalk console at https://console.aws.amazon.com/elasticbeanstalk/.

  2. From the AWS Elastic Beanstalk console applications page, click the name of the environment that you want to view logs for.

  3. In the navigation menu, click Logs. The Logs page lists the snapshot logs for your environment.

    1. To get the latest snapshot, click Snapshot Logs.

      This action takes a snapshot of the logs for your AWS Elastic Beanstalk application.

      Note

      It takes several seconds to retrieve the log files. You may need to click the Refresh button to see the contents of the log files.

  4. To view the contents of a log file, click View log file.

    A web page displays the text output of the log file snapshot.

A copy of the tail logs is placed in the Amazon S3 bucket associated with your application for 15 minutes. Depending on whether you are using a legacy or non-legacy container, you can access these logs in one of the following locations. If you are not sure if you are using a legacy or non-legacy container, see To check if you are using a legacy container type.

  • non-legacyelasticbeanstalk-region-account id/resources/environments/logs/tail/environment ID/instance ID/

    You can find your instance ID on the Logs page as shown in the previous diagram.

    You can find your environment ID in the Server section of the Instances configuration page.

    AWS Elastic Beanstalk Logs
  • legacy — Use the RetrieveEnvironmentInfo API to retrieve the location for the tail logs. For the CLI reference for this API, see elastic-beanstalk-retrieve-environment-info. For the API reference, go to RetrieveEnvironmentInfo in the AWS Elastic Beanstalk API Reference.

Configuring Your Environment to Publish Logs to Amazon S3

You can configure your environment so that the logs from the Amazon EC2 instances running your applications are copied by AWS Elastic Beanstalk to the Amazon S3 bucket associated with your application.

To configure your environment to publish logs to Amazon S3

  1. Open the AWS Elastic Beanstalk console at https://console.aws.amazon.com/elasticbeanstalk/.

  2. From the AWS Elastic Beanstalk console applications page, click the environment that you want to configure.

  3. In the Overview section of the environment dashboard, click Edit.

  4. On the Configuration page, click for Software Configuration in order to edit the container settings.

  5. Select Enable log file rotation to Amazon S3.

To access your logs

  1. Open the Amazon S3 console at https://console.aws.amazon.com/s3/.

  2. Depending on whether you are using a legacy or non-legacy container, navigate to one of the Amazon S3 locations. If you are not sure if you are using a legacy or non-legacy container, see To check if you are using a legacy container type.

    • legacyelasticbeanstalk-region-account id/environment name/logs/instance ID/

      For instructions on accessing your instance ID, see Listing and Connecting to Server Instances.

    • non-legacyelasticbeanstalk-region-account id/resources/environments/logs/publish/environment ID/instance ID/

      For instructions on accessing your instance ID, see Listing and Connecting to Server Instances.

      You can find your environment ID in the Server section of the Instances configuration page.

      AWS Elastic Beanstalk Logs