-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The flag ForceStopAsyncSend was added to fluent logger lib in v1.9.0
* When async is enabled, this option defines the interval (ms) at which the connection to the fluentd-address is re-established. This option is useful if the address may resolve to one or more IP addresses, e.g. a Consul service address. While the change in moby#42979 resolves the issue where a Docker container can be stuck if the fluentd-address is unavailable, this functionality adds an additional benefit in that a new and healthy fluentd-address can be resolved, allowing logs to flow once again. This adds a `fluentd-async-reconnect-interval` log-opt for the fluentd logging driver. Signed-off-by: Sebastiaan van Stijn <[email protected]> Signed-off-by: Conor Evans <[email protected]> Co-authored-by: Sebastiaan van Stijn <[email protected]> Co-authored-by: Conor Evans <[email protected]>
- Loading branch information
1 parent
3500d7e
commit 5cbc08c
Showing
2 changed files
with
63 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package fluentd // import "github.com/docker/docker/daemon/logger/fluentd" | ||
import ( | ||
"testing" | ||
|
||
"gotest.tools/v3/assert" | ||
) | ||
|
||
func TestValidateLogOptReconnectInterval(t *testing.T) { | ||
invalidIntervals := []string{"-1", "1", "-1s", "99ms", "11s"} | ||
for _, v := range invalidIntervals { | ||
t.Run("invalid "+v, func(t *testing.T) { | ||
err := ValidateLogOpt(map[string]string{asyncReconnectIntervalKey: v}) | ||
assert.ErrorContains(t, err, "invalid value for fluentd-async-reconnect-interval:") | ||
}) | ||
} | ||
|
||
validIntervals := []string{"100ms", "10s"} | ||
for _, v := range validIntervals { | ||
t.Run("valid "+v, func(t *testing.T) { | ||
err := ValidateLogOpt(map[string]string{asyncReconnectIntervalKey: v}) | ||
assert.NilError(t, err) | ||
}) | ||
} | ||
} |