amazon-ecs-agent: awslogs-stream option not supported by the awslogs driver

Task definitions cannot use the awslogs-stream option when using the awslogs driver : Log driver awslogs disallows options: awslogs-stream

The ability to configure the logstream name was mentioned several times already ( https://github.com/aws/amazon-ecs-agent/pull/251, https://github.com/aws/amazon-ecs-agent/issues/200 , https://github.com/aws/amazon-ecs-agent/issues/379 ) but I could not find an open issue capturing this need.

It would be great to be able to use string interpolation to customize logstream names while still guaranteeing their uniqueness inside a Loggroup.

eg something like

 "logConfiguration": {
        "logDriver": "awslogs",
        "options": {
          "awslogs-group": "loggroup",
          "awslogs-region": "us-east-1",
          "awslogs-stream": "logstream-docker-webapp-{CONTAINER_ID}",
        }
      }

This probably also relates to https://github.com/docker/docker/issues/17747

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 28
  • Comments: 17 (1 by maintainers)

Most upvoted comments

When I do this developers tell me it is difficult to search the logs. They would rather see all the streams in one place. Is it possible to support both awslogs_stream and awslogs_stream_prefix?

Today we launched support for awslogs-stream-prefix, which lets you name your log stream that includes the taskID so that it’s easy to go from a task to the log stream and from the log stream to the task. See the documentation for more information. http://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_awslogs.html

Does the prefix support variables like “{{.ImageID}}/{{.ID}}”? I’d like to get the ECS instance ID in the prefix as well.

Just replace awslogs-stream by awslogs-stream-prefix.