Skip to content

Add an option to skip create log stream for awslogs driver#42132

Merged
thaJeztah merged 1 commit into
moby:masterfrom
xia-wu:add-create-log-stream
Jul 19, 2021
Merged

Add an option to skip create log stream for awslogs driver#42132
thaJeztah merged 1 commit into
moby:masterfrom
xia-wu:add-create-log-stream

Conversation

@xia-wu
Copy link
Copy Markdown
Contributor

@xia-wu xia-wu commented Mar 10, 2021

Added an option awslogs-create-stream to allow skipping log stream creation for awslogs log driver. The default value is still true to keep the behavior be consistent with before.

Signed-off-by: Xia Wu [email protected]

- What I did
Added a new option awslogs-create-stream to awslogs log driver to allow skipping log stream creation in AWS CloudWatch Logs. It's very similar to awslogs-create-group but used for log stream creation.

- How I did it
Added a new option in awslogs log config map.

- How to verify it

  1. Built Docker locally and ran a Docker container with awslogs-create-stream=false with an existed log stream name in AWS CloudWatch Logs, the log stream creation was skipped and container started to run successfully.
docker run -d --command "echo hello" \
   --env xxx (credentials) \
   --log-driver=awslogs  \
   --log-opt awslogs-group=test-group \
   --log-opt awslogs-group=test-stream \
   --log-opt awslogs-region=us-west-2 \
   --log-opt awslogs-create-stream=false \
   busybox:latest 
  1. Also ran a Docker container without log option awslogs-create-stream and the log stream created in CloudWatch Logs successfully.
  2. Modified existing unit tests and added a unit test for skipped log stream creation.

- Description for the changelog
Added a new option to awslogs log driver to allow skipping log stream creation in AWS CloudWatch Logs.

- A picture of a cute animal (not mandatory but encouraged)
rabbit

Added an option `awslogs-create-stream` to allow skipping log stream
creation for awslogs log driver. The default value is still true to
keep the behavior be consistent with before.

Signed-off-by: Xia Wu <[email protected]>
@thaJeztah
Copy link
Copy Markdown
Member

/cc @samuelkarp @estesp

Copy link
Copy Markdown
Contributor

@estesp estesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Member

@samuelkarp samuelkarp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@samuelkarp
Copy link
Copy Markdown
Member

Close/reopen to see if I can trigger Jenkins again (old run is now a 404).

@samuelkarp samuelkarp closed this Jul 18, 2021
@samuelkarp samuelkarp reopened this Jul 18, 2021
@thaJeztah thaJeztah added this to the 21.xx milestone Jul 18, 2021
@thaJeztah thaJeztah merged commit 627bbd3 into moby:master Jul 19, 2021
@thaJeztah
Copy link
Copy Markdown
Member

Looks like we also need a documentation change to document the new option.
Given that it hasn't shipped yet, probably should be a "draft" PR to update this file in the documentation repository; https://github.com/docker/docker.github.io/blob/7238e69b20872d20c9211e0d1dfd634b21db6dbb/config/containers/logging/awslogs.md#awslogs-create-group

@xia-wu are you interested in opening a draft PR for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants