Customising Amazon Elastic Beanstalk with remote logging to PaperTrailApp

I’ve recently released a new website on AWS Elastic Beanstalk (EB) and thought I would document how I’ve set up centralised logging using papertrailapp.

The following steps use Amazon’s configuration files to customise the software stack running on an EC2 instance.


  1. Get syslog pushing entries into papertrailapp.
  2. Get other log files pushing to papertrailapp.
  3. Encrypt the logs during transport

Step 1: Get syslog pushing entries into papertrailapp

Knowing that the EC2 operating system is the Amazon Linux AMI we know that we are using rsyslog as our system logger. With this knowledge we can move straight into editing it’s config file.

Updating /etc/rsyslog.conf

The next step is to append a papertrailapp line along the lines of *.* to the bottom of the /etc/rsyslog.conf file, changing your port number as appropriate. Since it would be pointless doing this directly due to the very nature of an elastic provisioned architecture we are going to use the EB config files so we only have to do this once and once only.

Copy the contents from /etc/rsyslog.conf into a new file and append the papertraillapp log line to it. Now push this up to some place publicly accessible for download, such as Amazon’s S3 service.

Now within the root directory of your application, create a config file called .ebextensions/papertraillapp.config and paste into it the following content:

Obviously, change the source URL to point to the rsyslog file you uploaded earlier.

Continue reading