Browse code

Fluentd: add fluentd-async option, deprecate fluentd-async-connect

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2019/04/16 19:27:32
Showing 2 changed files
... ...
@@ -49,7 +49,8 @@ const (
49 49
 	defaultRetryWait  = 1000
50 50
 
51 51
 	addressKey            = "fluentd-address"
52
-	asyncConnectKey       = "fluentd-async-connect"
52
+	asyncKey              = "fluentd-async"
53
+	asyncConnectKey       = "fluentd-async-connect" // deprecated option (use fluent-async instead)
53 54
 	bufferLimitKey        = "fluentd-buffer-limit"
54 55
 	maxRetriesKey         = "fluentd-max-retries"
55 56
 	retryWaitKey          = "fluentd-retry-wait"
... ...
@@ -143,6 +144,7 @@ func ValidateLogOpt(cfg map[string]string) error {
143 143
 		case "tag":
144 144
 
145 145
 		case addressKey:
146
+		case asyncKey:
146 147
 		case asyncConnectKey:
147 148
 		case bufferLimitKey:
148 149
 		case maxRetriesKey:
... ...
@@ -193,6 +195,18 @@ func parseConfig(cfg map[string]string) (fluent.Config, error) {
193 193
 		maxRetries = int(mr64)
194 194
 	}
195 195
 
196
+	if cfg[asyncKey] != "" && cfg[asyncConnectKey] != "" {
197
+		return config, errors.Errorf("conflicting options: cannot specify both '%s' and '%s", asyncKey, asyncConnectKey)
198
+	}
199
+
200
+	async := false
201
+	if cfg[asyncKey] != "" {
202
+		if async, err = strconv.ParseBool(cfg[asyncKey]); err != nil {
203
+			return config, err
204
+		}
205
+	}
206
+
207
+	// TODO fluentd-async-connect is deprecated in driver v1.4.0. Remove after two stable releases
196 208
 	asyncConnect := false
197 209
 	if cfg[asyncConnectKey] != "" {
198 210
 		if asyncConnect, err = strconv.ParseBool(cfg[asyncConnectKey]); err != nil {
... ...
@@ -215,7 +229,8 @@ func parseConfig(cfg map[string]string) (fluent.Config, error) {
215 215
 		BufferLimit:        bufferLimit,
216 216
 		RetryWait:          retryWait,
217 217
 		MaxRetry:           maxRetries,
218
-		Async:              asyncConnect,
218
+		Async:              async,
219
+		AsyncConnect:       asyncConnect,
219 220
 		SubSecondPrecision: subSecondPrecision,
220 221
 	}
221 222
 
... ...
@@ -85,6 +85,11 @@ keywords: "API, Docker, rcli, REST, documentation"
85 85
   on the node.label. The format of the label filter is `node.label=<key>`/`node.label=<key>=<value>`
86 86
   to return those with the specified labels, or `node.label!=<key>`/`node.label!=<key>=<value>`
87 87
   to return those without the specified labels.
88
+* `POST /containers/create` now accepts a `fluentd-async` option in `HostConfig.LogConfig.Config`
89
+  when using the Fluentd logging driver. This option deprecates the `fluentd-async-connect`
90
+  option, which remains funtional, but will be removed in a future release. Users
91
+  are encouraged to use the `fluentd-async` option going forward. This change is
92
+  not versioned, and affects all API versions if the daemon has this patch.
88 93
 * `POST /containers/create`, `GET /containers/{id}/json`, and `GET /containers/json` now supports
89 94
   `BindOptions.NonRecursive`.
90 95
 * `POST /swarm/init` now accepts a `DataPathPort` property to set data path port number.