docker-archive / compose-cli

Easily run your Compose application to the cloud with compose-cli
Apache License 2.0
956 stars 253 forks source link

ECS context support for docker compose logs --since #2189

Open thorfi opened 1 year ago

thorfi commented 1 year ago

Description

ECS context logs does not support --since option

Steps to reproduce the issue:

  1. docker context use aws
  2. docker compose --verbose -f docker-compose.yml logs --follow --since 1m

Describe the results you received:

1 error occurred:
    * option "logs --since" on context type ECS.: unsupported flag

Describe the results you expected:

I expected that the since option would work correctly and provide recent logs, instead of the only option being to dump the entire logs since the creation of the stack (which for long running stacks is a huge problem).

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker-compose --version:

docker-compose --version
Docker Compose version dev

Output of docker version:

Client:
 Cloud integration: v1.0.28
 Version:           20.10.17
 API version:       1.41
 Go version:        go1.17.11
 Git commit:        100c701
 Built:             Mon Jun  6 23:04:45 2022
 OS/Arch:           darwin/arm64
 Context:           eyefi-aws
 Experimental:      true

Server: Docker Desktop 4.11.1 (84025)
 Engine:
  Version:          20.10.17
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.11
  Git commit:       a89b842
  Built:            Mon Jun  6 23:01:01 2022
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.6
  GitCommit:        10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
 runc:
  Version:          1.1.2
  GitCommit:        v1.1.2-0-ga916309
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output of docker context show:

aws

Output of docker context inspect context-name:

[
    {
        "Name": "aws",
        "Metadata": {
            "Type": "ecs"
        },
        "Endpoints": {
            "docker": {
                "SkipTLSVerify": false
            },
            "ecs": {
                "Profile": "aws-json"
            }
        },
        "TLSMaterial": {},
        "Storage": {
            "MetadataPath": "/Users/thorfinn/.docker/contexts/meta/cfe440cf32b484f0c47b62b18ed9e2a183e7afb0f1446be87bfd38fee9169480",
            "TLSPath": "/Users/thorfinn/.docker/contexts/tls/cfe440cf32b484f0c47b62b18ed9e2a183e7afb0f1446be87bfd38fee9169480"
        }
    }
]

Output of docker info:


Command "info" not available in current context (aws), you can use the "default" context to run this command```

**Additional environment details (AWS ECS, Azure ACI, local, etc.):**

AWS ECS
zaq42 commented 1 year ago
--since
--until
--tail

are all useful features of docker compose logs, but none are implemented for the ECS context.

For example:

1 error occurred:
    * option "logs --tail" on context type ECS.: unsupported flag

The logs are drawn from Cloudwatch. My workaround (for a staging environment) has been to apply a retention policy to the Log Group; but this doesn't really solve the problem.

An alternative would be to query the logs directly from Cloudwatch, but that starts to dilute the benefit of ECS/Compose.

zaq42 commented 1 year ago

The AWS Go SDK includes FilterLogEvents which, among other things, supports startTime and endTime which look like a good fit for the since and until CLI parameters.