From cc1f3c750e1da19c02be13ffd71d882af3e23c4a Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 16 Apr 2019 12:27:32 +0200 Subject: [PATCH] Fluentd: add fluentd-async option, deprecate fluentd-async-connect Signed-off-by: Sebastiaan van Stijn --- daemon/logger/fluentd/fluentd.go | 19 +++++++++++++++++-- docs/api/version-history.md | 5 +++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/daemon/logger/fluentd/fluentd.go b/daemon/logger/fluentd/fluentd.go index 1c48a00b87..748dba5352 100644 --- a/daemon/logger/fluentd/fluentd.go +++ b/daemon/logger/fluentd/fluentd.go @@ -49,7 +49,8 @@ const ( defaultRetryWait = 1000 addressKey = "fluentd-address" - asyncConnectKey = "fluentd-async-connect" + asyncKey = "fluentd-async" + asyncConnectKey = "fluentd-async-connect" // deprecated option (use fluent-async instead) bufferLimitKey = "fluentd-buffer-limit" maxRetriesKey = "fluentd-max-retries" retryWaitKey = "fluentd-retry-wait" @@ -143,6 +144,7 @@ func ValidateLogOpt(cfg map[string]string) error { case "tag": case addressKey: + case asyncKey: case asyncConnectKey: case bufferLimitKey: case maxRetriesKey: @@ -193,6 +195,18 @@ func parseConfig(cfg map[string]string) (fluent.Config, error) { maxRetries = int(mr64) } + if cfg[asyncKey] != "" && cfg[asyncConnectKey] != "" { + return config, errors.Errorf("conflicting options: cannot specify both '%s' and '%s", asyncKey, asyncConnectKey) + } + + async := false + if cfg[asyncKey] != "" { + if async, err = strconv.ParseBool(cfg[asyncKey]); err != nil { + return config, err + } + } + + // TODO fluentd-async-connect is deprecated in driver v1.4.0. Remove after two stable releases asyncConnect := false if cfg[asyncConnectKey] != "" { if asyncConnect, err = strconv.ParseBool(cfg[asyncConnectKey]); err != nil { @@ -215,7 +229,8 @@ func parseConfig(cfg map[string]string) (fluent.Config, error) { BufferLimit: bufferLimit, RetryWait: retryWait, MaxRetry: maxRetries, - Async: asyncConnect, + Async: async, + AsyncConnect: asyncConnect, SubSecondPrecision: subSecondPrecision, } diff --git a/docs/api/version-history.md b/docs/api/version-history.md index a7ad67e3e1..dca2149785 100644 --- a/docs/api/version-history.md +++ b/docs/api/version-history.md @@ -85,6 +85,11 @@ keywords: "API, Docker, rcli, REST, documentation" on the node.label. The format of the label filter is `node.label=`/`node.label==` to return those with the specified labels, or `node.label!=`/`node.label!==` to return those without the specified labels. +* `POST /containers/create` now accepts a `fluentd-async` option in `HostConfig.LogConfig.Config` + when using the Fluentd logging driver. This option deprecates the `fluentd-async-connect` + option, which remains funtional, but will be removed in a future release. Users + are encouraged to use the `fluentd-async` option going forward. This change is + not versioned, and affects all API versions if the daemon has this patch. * `POST /containers/create`, `GET /containers/{id}/json`, and `GET /containers/json` now supports `BindOptions.NonRecursive`. * `POST /swarm/init` now accepts a `DataPathPort` property to set data path port number.