AWS Elastic Beanstalk
Developer Guide (API Version 2010-12-01)

Instance Logs

The EC2 instances in your Elastic Beanstalk environment generate logs that you can view to troubleshoot issues with your application or configuration files. Logs created by the web server, application server, Elastic Beanstalk platform scripts, and AWS CloudFormation are stored locally on individual instances, and can be easily retrieved with the environment management console or the EB CLI. You can also configure your environment to stream logs to Amazon CloudWatch Logs in real time.

Tail logs are the last 100 lines of the most commonly used log files – Elastic Beanstalk operational logs and logs from the web server and/or application server. When you request tail logs in the environment management console or with eb logs, an instance in your environment concatenates the most recent log entries into a single text file and uploads it to Amazon S3.

Bundle logs are full logs for a wider range of log files, including logs from yum and cron and several logs from AWS CloudFormation. When you request bundle logs, an instance in your environment packages the full log files into a ZIP archive and uploads it to Amazon S3.


Elastic Beanstalk Windows Server platforms do not support bundle logs.

To retrieve logs in the environment management console, navigate to Logs, choose Request Logs, and then choose the type of logs to retrieve. To get tail logs, choose Last 100 Lines. To get bundle logs, choose Full Logs.

When Elastic Beanstalk finishes retrieving your logs, choose Download.

Tail and bundle logs are removed from Amazon S3 15 minutes after they are created. To persist logs, you can configure your environment to publish logs to Amazon S3 automatically after they have been rotated.

To enable log rotation to Amazon S3, navigate to the Software Configuration section of the Configuration page in the environment management console. Under Log Options, select Enable log file rotation to Amazon S3 and then choose Apply. Instances in your environment will attempt to upload logs that have been rotated once per hour.

To upload rotated logs to Amazon S3, the instances in your environment must have an instance profile with permission to write to your Elastic Beanstalk Amazon S3 bucket. These permissions are included in the default instance profile that Elastic Beanstalk prompts you to create when you launch an environment in the Elastic Beanstalk console for the first time.

If your application generates logs in a location that is not part of the default configuration for your environment's platform, you can extend the default configuration with configuration files (.ebextensions). You can add your application's log files to tail logs, bundle logs, or log rotation.

For real time log streaming and long term storage, configure your environment to stream logs to Amazon CloudWatch Logs.

Log Location on-Instance

Logs are stored in standard locations on the EC2 instances in your environment. Elastic Beanstalk generates the following logs:


  • /var/log/eb-activity.log

  • /var/log/eb-commandprocessor.log

  • /var/log/eb-version-deployment.log

Windows Server

  • C:\Program Files\Amazon\ElasticBeanstalk\logs\

These logs contain messages about deployment activities including messages related to configuration files (.ebextensions).

Each application and web server stores logs in its own folder:

  • Apache/var/log/httpd/

  • IISC:\inetpub\wwwroot\

  • Node.js/var/log/nodejs/

  • nginx/var/log/nginx/

  • Passenger/var/app/support/logs/

  • Puma/var/log/puma/

  • Python/opt/python/log/

  • Tomcat/var/log/tomcat8/

Log Location in S3

When you request tail or bundle logs from your environment, or instances upload rotated logs, they are stored in your Elastic Beanstalk bucket in Amazon S3. Elastic Beanstalk creates a bucket named elasticbeanstalk-region-account-id for each region in which you create environments. Within this bucket, logs are stored under the path resources/environments/logs/logtype/environment-id/instance-id.

For example, logs from instance i-0a1fd158, in Elastic Beanstalk environment e-mpcwnwheky in region us-west-2 in account 0123456789012, are stored in the following locations:

  • Tail Logs


  • Bundle Logs


  • Rotated Logs



You can find your environment ID in the environment management console.

Elastic Beanstalk deletes tail and bundle logs from Amazon S3 automatically 15 minutes after they are created. Rotated logs persist until you delete them or move them to Amazon Glacier.

Extending the Default Log Task Configuration

Elastic Beanstalk uses files in subfolders of /opt/elasticbeanstalk/tasks (Linux) or C:/Program Files/Amazon/ElasticBeanstalk/config (Windows Server) on the EC2 instance to configure tasks for tail logs, bundle logs and log rotation.


  • Tail Logs


  • Bundle Logs


  • Rotated Logs


Windows Server

  • Tail Logs

    c:/Program Files/Amazon/ElasticBeanstalk/config/taillogs.d/

  • Rotated Logs

    c:/Program Files/Amazon/ElasticBeanstalk/config/publogs.d/

For example, the file eb-activity.conf adds two logs files to the tail logs task:



You can add .conf files to these folder with configuration files (.ebextensions) to add log files specific to your application to those tasks.

Use the files key to add configuration files to the tasks that you want to modify. For example, the following configuration file adds a config to each instance in your environment that adds /var/log/cloud-init.log to tail logs:

  "/opt/elasticbeanstalk/tasks/taillogs.d/cloud-init.conf" :
    mode: "000755"
    owner: root
    group: root
    content: |

Add this text to a file with the .config extension to your source bundle under a folder named .ebextensions:

|-- .ebextensions
|   `-- tail-logs.config
|-- index.php
`-- styles.css

You can also use wildcards in log task configurations. This configuration file adds all files with the .log extension from the log folder in the application root to bundle logs:

  "/opt/elasticbeanstalk/tasks/bundlelogs.d/applogs.conf" :
    mode: "000755"
    owner: root
    group: root
    content: |

For more information on using configuration files, see Advanced Environment Customization with Configuration Files (.ebextensions).

Instance-Local Log Rotation Settings

On Linux platforms, Elastic Beanstalk uses logrotate to rotate logs periodically. After a log is rotated locally, it gets picked up by the log rotation task and is uploaded to Amazon S3 if configured. Logs that have been rotated locally do not appear in tail or bundle logs by default.

You can find Elastic Beanstalk's configuration files for logrotate in /etc/logrotate.elasticbeanstalk.hourly/. The specific rotation settings are platform specific and may change in future versions of the platform. For more information on the available settings and example configurations, run man logrotate.

The configuration files are invoked by cron jobs in /etc/cron.hourly/. For more information on cron, run man cron.

Amazon CloudWatch Logs

You can configure your environment to stream logs to Amazon CloudWatch Logs in the AWS Management Console or with configuration options. With CloudWatch Logs, each instance in your environment streams logs to log groups that you can configure to be retained for weeks or years, even after your environment is terminated.

The set of logs streamed varies per environment but always includes eb-activity.log and access logs from the nginx or Apache proxy server that runs in front of your application.

You can configure log streaming in the AWS Management Console during environment creation on the Software settings page, as shown in the following screen shot, which saves logs up to 60 days, even when the environment has terminated.

CloudWatch logs settings

The following configuration file enables log streaming with 180 days retention, even if the environment is terminated:

Example .ebextensions/log-streaming.config

    StreamLogs: true
    DeleteOnTerminate: false
    RetentionInDays: 180