Documentation forPapertrail

Fluentd

Fluentd logs can be redirected to Papertrail using FireLens, a SolarWinds plugin. Before using this plugin, familiarize yourself with FireLens for Amazon ECS.

Requirements

  • Amazon AWS active account

How to start with Papertrail and FireLens for Amazon ECS

To start with FireLens for Amazon ECS, use our SolarWinds prepared Fluentd image or create your own customized Fluentd image using Docker.

1. Create task definition

To start collecting logs from applications, first prepare a task definition. You can build on the example provided for Papertrail (EC2). Modify it to work with your applications while leaving the logConfiguration section intact to easily add a logging capability to your application.

Update the executionRoleArn with a valid ECS IAM Role and the logConfiguration section with the correct Papertrail hostname and port number:

Copy
{
    "family": "ec2-nginx-to-papertrail",
    "executionRoleArn": 
"arn:aws:iam::aws-account-id:role/role-name-with-path",
    "requiresCompatibilities": [
        "EC2"
    ],
"containerDefinitions": [
{
"essential": true,
"image": "solarwinds/fluentd-papertrail",
"name": "log_router",
"firelensConfiguration": {
                "type": "fluentd"
            },
"memory": 150
       },
       {
           "essential": true,
           "image": "nginx",
           "name": "nginx-logging-to-papertrail",
           "dependsOn": [
              {
                  "containerName": "log_router",
                  "condition": "START"
              }
           ],
           "portMappings": [
              {
                  "hostPort": 80,
                  "containerPort": 80,
                  "protocol": "tcp"
              }
          ],
"logConfiguration": {
        "logDriver": "awsfirelens",
        "options": {
          "@type": "papertrail",
          "papertrail_host": "logsX.papertrailapp.com",
          "papertrail_port": "50000"
}
          },
          "memory": 100
      }
]
}

The example task definition deploys a Nginx server along with a Fluentd container for passing log messages to Papertrail.

2. Register task definition

Register your task definition in your AWS Console (Services -> ECS > Task Definitions). When completed, verify whether the task definition has been successfully registered in the AWS Console (Services > ECS > Task Definitions).

3. Create an ECS Cluster

Go to Amazon ECS > Clusters, click “Create Cluster” button, and follow the wizard to create a new ECS cluster. More information on creating cluster can be found in Amazon ECS documentation

4. Run a Task on ECS Cluster

Go to Amazon ECS > Clusters and click on the cluster’s name you just created. Open the Tasks tab and click “Run New Task”. In the wizard that opens, choose the “Launch Type” and “Task Definition” you want to use for your task. Fill any required fields and click “Run Task”. For more information, see the AWS documentation on running tasks.

After starting the task on your ECS cluster, you should have two live containers where one is running Nginx. Using its public IP, you’ll be able to reach the Nginx server from your browser to generate logs that will be redirected to Papertrail.

You should be able now to see logs from your containers pushed to Papertrail.