AWS Elastic Beanstalk is an easy way to quickly deploy and manage applications in the Amazon Web Services cloud. 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.
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 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” below.
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.
The configuration file lists the log file paths which 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.
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.
We’re happy to help. Ask a question or join support chat here.