Skip to content

Commit

Permalink
Merge pull request moby#46114 from akerouanton/remove-fluentd-async-c…
Browse files Browse the repository at this point in the history
…onnect

logger/fluentd: remove deprecated fluentd-async-connect option
  • Loading branch information
thaJeztah authored Jan 13, 2025
2 parents 22d3a32 + 49ec488 commit b59e5cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
10 changes: 10 additions & 0 deletions daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,16 @@ func (daemon *Daemon) restore(cfg *configStore) error {
delete(c.NetworkSettings.Networks, networktypes.NetworkDefault)
}
}

// The logger option 'fluentd-async-connect' has been
// deprecated in v20.10 in favor of 'fluentd-async', and
// removed in v28.0.
// TODO(aker): remove this migration once the next LTS version of MCR is released.
if _, ok := c.HostConfig.LogConfig.Config["fluentd-async-connect"]; ok {
if _, ok := c.HostConfig.LogConfig.Config["fluentd-async"]; !ok {
c.HostConfig.LogConfig.Config["fluentd-async"] = c.HostConfig.LogConfig.Config["fluentd-async-connect"]
}
}
}

if err := daemon.checkpointAndSave(c); err != nil {
Expand Down
17 changes: 1 addition & 16 deletions daemon/logger/fluentd/fluentd.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ const (

addressKey = "fluentd-address"
asyncKey = "fluentd-async"
asyncConnectKey = "fluentd-async-connect" // deprecated option (use fluent-async instead)
asyncReconnectIntervalKey = "fluentd-async-reconnect-interval"
bufferLimitKey = "fluentd-buffer-limit"
maxRetriesKey = "fluentd-max-retries"
Expand Down Expand Up @@ -149,7 +148,6 @@ func ValidateLogOpt(cfg map[string]string) error {

case addressKey:
case asyncKey:
case asyncConnectKey:
case asyncReconnectIntervalKey:
case bufferLimitKey:
case maxRetriesKey:
Expand Down Expand Up @@ -201,25 +199,13 @@ 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 {
return config, err
}
}

asyncReconnectInterval := 0
if cfg[asyncReconnectIntervalKey] != "" {
interval, err := time.ParseDuration(cfg[asyncReconnectIntervalKey])
Expand Down Expand Up @@ -256,11 +242,10 @@ func parseConfig(cfg map[string]string) (fluent.Config, error) {
RetryWait: retryWait,
MaxRetry: maxRetries,
Async: async,
AsyncConnect: asyncConnect,
AsyncReconnectInterval: asyncReconnectInterval,
SubSecondPrecision: subSecondPrecision,
RequestAck: requestAck,
ForceStopAsyncSend: async || asyncConnect,
ForceStopAsyncSend: async,
}

return config, nil
Expand Down

0 comments on commit b59e5cd

Please sign in to comment.