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.
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
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 Aggregating logs using system-level tools.
Papertrail works with both
.ebextensions and custom AMIs.
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.
Some Elastic Beanstalk apps already require a custom AMI. Configure Papertrail as part of your custom AMI by following any of Papertrail’s standard Unix or Windows Configuration instructions.
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.
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.
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.
We’re happy to help. Ask a question or join support chat here.