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. Navigate to the logs for your application.

    1. Select your application from the drop-down list at the top.

    2. Below the application selection drop-down list, click Environment Details for your application in the application's Environments list.

    3. Click the Logs tab.

  3. Click the Snapshot Logs button.

    This action takes a snapshot of the logs for your AWS Elastic Beanstalk application. The log file appears in the Logs panel.

    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.

    AWS Elastic Beanstalk Logs
  4. Click the View log file link.

    A web page displaying the text output of the log file snapshot opens.

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 tab as shown in the previous diagram.

    You can find your environment ID on the Server tab in the Edit Configuration dialog box. You can access this dialog box from the Overview tab in the Environment Details pane.

    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.

  1. Configure your environment to publish logs to Amazon S3.

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

    2. Select your application from the drop-down list at the top.

    3. Below the application selection drop-down list, click Environment Details for your application in the application's Environments list.

    4. Click Edit Configuration.

    5. From the Container tab, select Enable log file rotation to Amazon S3, and then click Apply Changes.

  2. 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 on the Server tab in the Edit Configuration dialog box. You can access this dialog box from the Overview tab in the Environment Details pane.

        AWS Elastic Beanstalk Logs