Documentation forPapertrail

Amazon ECS


This setup adapts Papertrail's Docker logspout instructions for Amazon ECS. Logspout is a lightweight log router for Docker.


Create a task definition

  1. Open the Amazon ECS console.
  2. If multiple regions are available, from the navigation bar, select the region in which to register your task definition.
  3. In the left sidebar, select Task Definitions, and click Create new Task Definition.
  4. Enter a name for the definition (for example, logspout).
  5. Click Add volume.
  6. In the Add volume dialog, name the volume (for example, dockersock) and enter /var/run/docker.sock as the Source path.
  7. Click Add.
  8. Under Container Definitions, click Add container.
  9. Enter the container details in the Add container dialog:
    • Provide a Container name (such as logspout).
    • For Image, enter gliderlabs/logspout:latest: container fields
    • In Advanced Container Configuration, under ENVIRONMENT, enter syslog+tls:// as the Command value, replacing logsN and XXXXX with details from the Papertrail log destination: advanced container fields
    • Under STORAGE AND LOGGING > Mount points, select the docker socket volume name as the Source volume, and enter /var/run/docker.sock as the Container path: storage and logging
    • Click Add.
  10. Click Create to create the task definition.

Create a service using the task

  1. If coming from the Task Definition name page, first select the revision of the task definition to use to create your service.
  2. Review and click Actions > Create Service.
  3. Fill in the service fields, with Number of Tasks being equivalent to the number of instances in the cluster. Provide a name (such as logspout) and other values based on the desired cluster setup.
  4. Select One Task per Host for Placement Templates. This sets up one logspout container per instance, to prevent log duplication.
  5. Review other settings, and click Create Service.

There will now be logspout containers running on each host, ready to accept logs from your other containers and send them to Papertrail.

Configure containers to log through logspout

For each container that should log through logspout:

  1. Access the container's task definition.
  2. Select Actions > Create New Revision.
  3. Click the container's name.
  4. In the Edit Container dialog, under STORAGE AND LOGGING > Log configuration, set Log driver to either json-file or journald.
  5. Click Update.
  6. On the revision screen, click Actions > Update Service to update the service to the new task definition version.

Once the services are updated, visit the Event viewer to see logs come in.