Skip to content

Streaming Logs: ECS Fargate


Overview

This topic describes how user may setup log streaming for containerized web applications running on serverless runtime such as ECS Fargate.

Streaming Logs

Install Agent - ECS Fargate

CloudAEye SaaS console shows the instructions to setup agent for logs streaming.

To view the instructions in console, select Logs Services from the left navigation menu. User will see a list of logs services that are already created in the system. Click on the name of the logs service under Service Name column.

Configure App for Log Collection

Under Configure App for Log Collection section, select ECS Fargate from the drop-down menu.

ECSFargateBasic

  • App Name: Name of the application.
  • Cluster Name: Name of the ECS cluster.
  • Service Name: List of the services running on ECS cluster. Enter * for all.
  • Update Service: Enable to automatically update the ECS services after adding CloudAEye agent as a side car.

Press Create button. The agent setup instructions for ECS Fargate will be shown. You may also click on the View Commands icon on the app to see the agent setup instructions.

Step 1: Download the script

ECSFargateStep1

You will see a command similar to the following:

curl -o aws_ecs_fargate_agent.py https://cae-data-collection-agent.s3.us-east-2.amazonaws.com/ecs-fargate/scripts/aws_ecs_fargate_agent.py

Run this command on AWS CloudShell.

Step 2: Install boto3

ECSFargateStep2

Run the following command on AWS CloudStell.

pip3 install boto3 

Step 3: Install Agent

ECSFargateStep3

Run a command similar to the following on AWS CloudShell.

python3 aws_ecs_fargate_agent.py \
   --agent-mode create \
   --service-names '*' \
   --cluster-name 'my-cluster' \
   --enable-logs 'yes' \
   --cloud-env aws \
   --logs-destination http \
   --destination-http-url ${deatination-url} \
   --app-name 'My App' \
   --app-key MA \
   --user-key ${user-key} \
   --user-secret ${user-secret} \
   --update-services

Agent Details

Please refer to agent description under Troubleshooting section for details.

Troubleshooting

Please refer to log streaming description under Troubleshooting section for details.