[ECS][Request]add support for LogConfig Options "Type" and "Config:Labels"
- Dominant language
- Shell
- Stars
- 5.4k
- Forks
- 334
- PR merge metrics
- No merged PRs in 30d
Description
### Summary
I would like the ability to add one (or both) of "Type" and "Config:Labels" to the logs produced by the ECS Agent. The purpose of this is to have greater control over the log destination and log format. As an example, one of the companies I work with uses the logConfig as follows for all containers:
```
"LogConfig": {
"Type": "json-file",
"Config": {
"labels": "container_name,git_sha"
}
},
```
The purpose of the labels is that Docker logdriver will create logs that have the value `container_name` embedded in JSON output and this can be then used to filter logs based on particular values (for instance, all of their containers are assigned a container name).
### Description
See above.
### Expected Behavior
I was hopeful that I would be able to assign "labels" to the log files written by the ECS Container Agent when launched on Amazon Linux 2 / by the amazon-ecs-init RPM.
### Observed Behavior
I was unable to assign "labels" to the logfiles written by the ECS Container Agent.
### Environment Details
Amazon Linx Version:
```
[root@ip-10-130-71-144 systemd]# uname -a
Linux ip-10-130-71-144.us-west-2.compute.internal 4.14.123-111.109.amzn2.x86_64 aws/amazon-ecs-init#1 SMP Mon Jun 10 19:37:57 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
```
Docker Version:
```
[root@ip-10-130-71-144 systemd]# docker --version
Docker version 18.06.1-ce, build e68fc7a215d7133c34aa18e3b72b4a21fd0c6136
```
ECS Agent:
```
"Image": "amazon/amazon-ecs-agent:latest"
"Image": "sha256:267bac512a39389e6ad2f0b9dfd04153c6950da89a88037ec32490eaeeee5f3a"
```
Contributor guide
Research direction
No repository files, tests, or implementation entry points are named. Start by locating the ECS Agent handling for container log configuration and compare its supported options with Docker's Type and Config:Labels behavior; done means those options can be assigned and produce the requested labeled log output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, linux
- Domain
- cloud, infrastructure, observability
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100