AWS Elastic Beanstalk


AWS Elastic Beanstalk is a way to quickly deploy and manage applications in Amazon Web Services. Elastic Beanstalk supports Java, PHP, Python, Ruby, .NET, and Node.js apps. Here’s how to aggregate app and system logs from Elastic Beanstalk instances.


Method A: Aggregating logs directly from app/framework

Logs from apps on Elastic Beanstalk can often be aggregated with the same in-app logging libraries you would use without Elastic Beanstalk. For example, a Java app might use logback or log4j, a .NET app might use NLog or log4net, and a Ruby app might use a Logger class like remote_syslog_logger.

To configure your Elastic Beanstalk app to log to Papertrail, follow the instructions for the log library or language/framework you use, like log4j, logback, or PHP. See Configuration.

If you have not chosen a log library or are not using a logging framework, skim Configuration for ideas or ask us and we’ll suggest one.

If in-app log aggregation doesn’t fit your situation or you also want other logs (like Linux syslog), continue to Method B: Aggregating logs using system-level tools.

Method B: Aggregating logs using system-level tools

Papertrail works with either method of Elastic Beanstalk container customization:

Finally, if neither of the above are suitable, please contact us to see what other options we may have. We can usually suggest a solution based on your environment.

Container configuration

The example Elastic Beanstalk log aggregation mentioned above tells Elastic Beanstalk’s provisioning stack to write a configuration file and init script for remote_syslog2.

The configuration file lists the log file paths that should be transmitted to Papertrail. Finally, the config file installs remote_syslog2 and tells Elastic Beanstalk to start it at boot time (via the init script). You will need to modify at least the source URL to include the remote_syslog2 version number, log file paths, and log destination.

Integration with instance provisioning

Both pre-made and custom images can use a powerful feature of Elastic Beanstalk: the commands configuration file option. This option allows app owners to specify commands to run after an instance boots. Read more.

If your instance provisioning process includes hitting an API (such as Papertrail’s HTTP API or altering the system configuration, the commands config option is a good place for it.

Legacy Container Configuration

The configurations above are recommended for any new setups. If for some reason remote_syslog2 won’t work for you, using the original Ruby remote_syslog is an option.

An example Elastic Beanstalk log aggregation config file for ruby remote_syslog was created by Papertrail customer (Táve) for their own use.


We’re happy to help. Ask a question or join support chat here.