Coralogix provides integration to collect and send your ECS
cluster logs straight to Coralogix.
Private Key – Your private key is a unique ID representing your company.
Application Name – The name of your main application, for example, a company named “SuperData” would probably insert the “SuperData” string parameter or if they want to debug their test environment they might insert the “SuperData– Test”.
SubSystem Name – Your application probably has multiple subsystems, for example Backend servers, Middleware, Frontend servers, etc. in order to help you examine the data you need, inserting the subsystem parameter is vital.
To start sending logs from your ecs ec2 containers we need to create a new ECS Task Definition
.
Go to the ECS console and choose ‘Task Definitions’ -> ‘Create new task definition’.
Under ‘Select launch type compatibility:
Scroll all the way down and click on the ‘Configure via JSON’ button.
Replace inside the file these environment variables:
You can add these environment variables, if they’re not added the default is a dynamic value:
Run AWS ECS Task
on your cluster:
Choose Placement Template
as One Task Per Host
:
Note: change ‘Number of tasks’ to be your number of ECS instances in the cluster.
When the task is ready, logs will start shipping to Coralogix.
To start sending logs from your ecs fargate containers we need to create a new ECS Task Definition
.
Go to the ECS console and choose ‘Task Definitions’ -> ‘Create new task definition’.
Under ‘Select launch type compatibility:
Scroll down and under ‘Log router integration’:
It will add log_router container to the “Containers definitions” section.
If you haven’t added your application container yet then do it now to have two containers on the list.
Configure awsfirelens
logging driver for the container which you want to send the logs from (in the example above it is testapp container):
Next click on the ‘log_router’ container to edit it:
Under ‘Environment variables’ add these variables:
In order to get dynamic values for APP_NAME and SUB_SYSTEM, delete the lines from the Environment variables. The values are taken from:
Example:
Save the changes to the container.
Scroll all the way down and click on the ‘Configure via JSON’ button.
Replace ‘fireLensConfiguration’:
"firelensConfiguration": { "type": "fluentd" },
with
"firelensConfiguration": { "type": "fluentd", "options": { "config-file-type": "file", "config-file-value": "/fluentd/etc/firelens.conf" } },
Note: To manage multiline logs you will need to build the fluentd image from here while adding a concat filter in the firelens.conf that match your needs.
Region | cluster URL |
EU | api.coralogix.com |
US | api.coralogix.us |
IN | api.app.coralogix.in |
EU2 | api.eu2.coralogix.com |
SG | api.coralogixsg.com |