From 008fc679742b1f6dc386b728887573987ac09feb Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 16 Apr 2019 12:42:54 +0200 Subject: [PATCH] Fluentd: add fluentd-request-ack option This adds a new `fluentd-request-ack` logging option for the Fluentd logging driver. If enabled, the server will respond with an acknowledgement. This option improves the reliability of the message transmission. This change is not versioned, and affects all API versions. Signed-off-by: Sebastiaan van Stijn --- daemon/logger/fluentd/fluentd.go | 10 ++++++++++ docs/api/version-history.md | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/daemon/logger/fluentd/fluentd.go b/daemon/logger/fluentd/fluentd.go index 748dba5352e310c4e39a3671710660dcefd1b237..829b606c9f3f8da38ba198ba475c3a8933b0311c 100644 --- a/daemon/logger/fluentd/fluentd.go +++ b/daemon/logger/fluentd/fluentd.go @@ -53,6 +53,7 @@ const ( asyncConnectKey = "fluentd-async-connect" // deprecated option (use fluent-async instead) bufferLimitKey = "fluentd-buffer-limit" maxRetriesKey = "fluentd-max-retries" + requestAckKey = "fluentd-request-ack" retryWaitKey = "fluentd-retry-wait" subSecondPrecisionKey = "fluentd-sub-second-precision" ) @@ -148,6 +149,7 @@ func ValidateLogOpt(cfg map[string]string) error { case asyncConnectKey: case bufferLimitKey: case maxRetriesKey: + case requestAckKey: case retryWaitKey: case subSecondPrecisionKey: // Accepted @@ -221,6 +223,13 @@ func parseConfig(cfg map[string]string) (fluent.Config, error) { } } + requestAck := false + if cfg[requestAckKey] != "" { + if requestAck, err = strconv.ParseBool(cfg[requestAckKey]); err != nil { + return config, err + } + } + config = fluent.Config{ FluentPort: loc.port, FluentHost: loc.host, @@ -232,6 +241,7 @@ func parseConfig(cfg map[string]string) (fluent.Config, error) { Async: async, AsyncConnect: asyncConnect, SubSecondPrecision: subSecondPrecision, + RequestAck: requestAck, } return config, nil diff --git a/docs/api/version-history.md b/docs/api/version-history.md index dca2149785c6c9d8c953e0d831ecc9768a8be2ee..8d583ee99a4cc1179d13575844d0dd221b2e089b 100644 --- a/docs/api/version-history.md +++ b/docs/api/version-history.md @@ -90,6 +90,12 @@ keywords: "API, Docker, rcli, REST, documentation" 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` now accepts a `fluentd-request-ack` option in + `HostConfig.LogConfig.Config` when using the Fluentd logging driver. If enabled, + the Fluentd logging driver sends the chunk option with a unique ID. The server + will respond with an acknowledgement. This option improves the reliability of + the message transmission. 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.