Skip to main content

AWS ECS

note

For a much easier and more efficient way to collect and send telemetry, consider using the Logz.io telemetry collector.

Configure AWS to forward logs to Logz.io

This integration uses Fluentd in a Docker container to forward logs from your Amazon Elastic Container Service (ECS) cluster to Logz.io.

note

This integration refers to an EC2-based cluster. For Fargate-based cluster see our Fargate documentation.

Important

Fluentd will fetch all existing logs, as it is not able to ignore older logs.

Automated CloudFormation deployment

Configure and create your stack

Click the button that matches your AWS region, then follow the instructions below:

AWS RegionLaunch button
us-east-1Deploy to AWS
note

If your region is not on the list, let us know in the repo's issues, or reach out to Logz.io support team!

####### In screen Step 1 Specify template:

Keep the defaults and click Next.

Screen_1

####### In screen Step 2 Specify stack details:

  1. For Stack name you can either keep the default, or change the stack name.

  2. For LogzioListener - choose your Logz.io listener from the list.

  3. For LogzioToken - insert your Logz.io logs shipping token.

  4. Click Next.

Screen_2

####### In screen Step 3 Configure stack options (Optional):

If you want to, you can add your custom tags, or not. Click on Next.

####### In screen Step 4 Review:

Scroll down and click on Create stack.

Give your stack a few moments to launch.

Run the task

  1. Go to your AWS ECS page, and on the left menu, click on Task Definitions, then choose the task you just created.

  2. Click on the Actions button, then choose Run Task.

  3. In the Run Task screen, choose EC2 as your Launch type.

  4. Choose the cluster you want to ship logs from.

  5. For Placement Templates choose One Task Per Host.

  6. Click on Run Task.

Check Logz.io for your logs

Give your logs some time to get from your system to ours, and then open Open Search Dashboards.

Manual deployment (AWS Classic Console)

Download the task definition JSON

wget https://raw.githubusercontent.com/logzio/logzio-aws-ecs/master/task-definition.json

Configure the task

In your prefered text editor, open the JSON you downloaded in the previous step and replace the following:

ParamaterDetails
<<LOG-SHIPPING-TOKEN>>Required. Your Logz.io account token. Replace with the token of the account you want to ship to.
<<LISTENER-HOST>>Required. Your Logz.io listener URL. Replace with your region's listener URL.

Advanced settings (optional)

Since the Docker image is based on Logz.io's fluentd-docker-logs image, any of the environment variables mentioned here can be added to the task definition JSON.

Add your task definition

  1. In your Amazon ECS Classic Console menu, go to Task Definitions and click on Create new Task Definition.

  2. In the Step 1: Select launch type compatibility screen, choose EC2 and click Next step.

  3. In the Step 2: Configure task and container definitions screen, scroll down and click on the Configure via JSON button.

  4. In the text-box, delete the existing text and paste your configured task definition JSON. Press Save, then press Create.

Run the task

  1. After the task creation, click on the Actions button, then choose Run Task.

  2. In the Run Task screen, choose EC2 as your Launch type.

  3. Choose the cluster you want to ship logs from.

  4. For Placement Templates, choose One Task Per Host.

  5. Click on Run Task.

Check Logz.io for your logs

Give your logs some time to get from your system to ours, and then open Open Search Dashboards.

Configure AWS to forward metrics to Logz.io

Deploy this integration to send your Amazon ECS metrics to Logz.io.

This integration creates a Kinesis Data Firehose delivery stream that links to your Amazon ECS metrics stream and then sends the metrics to your Logz.io account. It also creates a Lambda function that adds AWS namespaces to the metric stream, and a Lambda function that collects and ships the resources' tags.

Install the pre-built dashboard to enhance the observability of your metrics.

To view the metrics on the main dashboard, log in to your Logz.io Metrics account, and open the Logz.io Metrics tab.

Before you begin, you'll need:

  • An active Logz.io account

Configure AWS to forward metrics to Logz.io

1. Set the required minimum IAM permissions

configured the minimum required IAM permissions as follows:

  • Amazon S3:
    • s3:CreateBucket
    • s3:DeleteBucket
    • s3:PutObject
    • s3:GetObject
    • s3:DeleteObject
    • s3:ListBucket
    • s3:AbortMultipartUpload
    • s3:GetBucketLocation
  • AWS Lambda:
    • lambda:CreateFunction
    • lambda:DeleteFunction
    • lambda:InvokeFunction
    • lambda:GetFunction
    • lambda:UpdateFunctionCode
    • lambda:UpdateFunctionConfiguration
    • lambda:AddPermission
    • lambda:RemovePermission
    • lambda:ListFunctions
  • Amazon CloudWatch:
    • cloudwatch:PutMetricData
    • cloudwatch:PutMetricStream
    • logs:CreateLogGroup
    • logs:CreateLogStream
    • logs:PutLogEvents
    • logs:DeleteLogGroup
    • logs:DeleteLogStream
  • AWS Kinesis Firehose:
    • firehose:CreateDeliveryStream
    • firehose:DeleteDeliveryStream
    • firehose:PutRecord
    • firehose:PutRecordBatch
  • IAM:
    • iam:PassRole
    • iam:CreateRole
    • iam:DeleteRole
    • iam:AttachRolePolicy
    • iam:DetachRolePolicy
    • iam:GetRole
    • iam:CreatePolicy
    • iam:DeletePolicy
    • iam:GetPolicy
  • Amazon CloudFormation:
    • cloudformation:CreateStack
    • cloudformation:DeleteStack
    • cloudformation:UpdateStack
    • cloudformation:DescribeStacks
    • cloudformation:DescribeStackEvents
    • cloudformation:ListStackResources

2. Create Stack in the relevant region

To deploy this project, click the button that matches the region you wish to deploy your Stack to:

RegionDeployment
us-east-1Deploy to AWS
us-east-2Deploy to AWS
us-west-1Deploy to AWS
us-west-2Deploy to AWS
eu-central-1Deploy to AWS
eu-central-2Deploy to AWS
eu-north-1Deploy to AWS
eu-west-1Deploy to AWS
eu-west-2Deploy to AWS
eu-west-3Deploy to AWS
eu-south-1Deploy to AWS
eu-south-2Deploy to AWS
sa-east-1Deploy to AWS
ap-northeast-1Deploy to AWS
ap-northeast-2Deploy to AWS
ap-northeast-3Deploy to AWS
ap-south-1Deploy to AWS
ap-south-2Deploy to AWS
ap-southeast-1Deploy to AWS
ap-southeast-2Deploy to AWS
ap-southeast-3Deploy to AWS
ap-southeast-4Deploy to AWS
ap-east-1Deploy to AWS
ca-central-1Deploy to AWS
ca-west-1Deploy to AWS
af-south-1Deploy to AWS
me-south-1Deploy to AWS
me-central-1Deploy to AWS
il-central-1Deploy to AWS

3. Specify stack details

Specify the stack details as per the table below, check the checkboxes and select Create stack.

ParameterDescriptionRequired/Default
logzioListenerLogz.io listener URL for your region. (For more details, see the regions page. e.g., https://listener.logz.io:8053Required
logzioTokenYour Logz.io metrics shipping token.Required
awsNamespacesComma-separated list of AWS namespaces to monitor. See this list of namespaces. Use value all-namespaces to automatically add all namespaces.At least one of awsNamespaces or customNamespace is required
customNamespaceA custom namespace for CloudWatch metrics. Used to specify a namespace unique to your setup, separate from the standard AWS namespaces.At least one of awsNamespaces or customNamespace is required
logzioDestinationYour Logz.io destination URL. Choose the relevant endpoint from the drop down list based on your Logz.io account region.Required
httpEndpointDestinationIntervalInSecondsBuffer time in seconds before Kinesis Data Firehose delivers data.60
httpEndpointDestinationSizeInMBsBuffer size in MBs before Kinesis Data Firehose delivers data.5
debugModeEnable debug mode for detailed logging (true/false).false

4. View your metrics

Allow some time for data ingestion, then open your Logz.io metrics account.

Install the pre-built dashboard to enhance the observability of your metrics.

To view the metrics on the main dashboard, log in to your Logz.io Metrics account, and open the Logz.io Metrics tab.