Added SubSecondPrecision flag in fluentd logger

Signed-off-by: dungeonmaster18 <umesh4257@gmail.com>
Upstream-commit: a1ebda09bab5bf22d96a15e71618c4a0ac08bb55
Component: engine
This commit is contained in:
Umesh Yadav
2017-12-05 17:21:57 +05:30
committed by dungeonmaster18
parent ae808b0eb3
commit 12e67ce519
26 changed files with 1317 additions and 574 deletions
@@ -48,11 +48,12 @@ const (
defaultRetryWait = 1000
defaultMaxRetries = math.MaxInt32
addressKey = "fluentd-address"
bufferLimitKey = "fluentd-buffer-limit"
retryWaitKey = "fluentd-retry-wait"
maxRetriesKey = "fluentd-max-retries"
asyncConnectKey = "fluentd-async-connect"
addressKey = "fluentd-address"
bufferLimitKey = "fluentd-buffer-limit"
retryWaitKey = "fluentd-retry-wait"
maxRetriesKey = "fluentd-max-retries"
asyncConnectKey = "fluentd-async-connect"
subSecondPrecisionKey = "fluentd-sub-second-precision"
)
func init() {
@@ -117,15 +118,23 @@ func New(info logger.Info) (logger.Logger, error) {
}
}
subSecondPrecision := false
if info.Config[subSecondPrecisionKey] != "" {
if subSecondPrecision, err = strconv.ParseBool(info.Config[subSecondPrecisionKey]); err != nil {
return nil, err
}
}
fluentConfig := fluent.Config{
FluentPort: loc.port,
FluentHost: loc.host,
FluentNetwork: loc.protocol,
FluentSocketPath: loc.path,
BufferLimit: bufferLimit,
RetryWait: retryWait,
MaxRetry: maxRetries,
AsyncConnect: asyncConnect,
FluentPort: loc.port,
FluentHost: loc.host,
FluentNetwork: loc.protocol,
FluentSocketPath: loc.path,
BufferLimit: bufferLimit,
RetryWait: retryWait,
MaxRetry: maxRetries,
AsyncConnect: asyncConnect,
SubSecondPrecision: subSecondPrecision,
}
logrus.WithField("container", info.ContainerID).WithField("config", fluentConfig).
@@ -183,6 +192,7 @@ func ValidateLogOpt(cfg map[string]string) error {
case retryWaitKey:
case maxRetriesKey:
case asyncConnectKey:
case subSecondPrecisionKey:
// Accepted
default:
return fmt.Errorf("unknown log opt '%s' for fluentd log driver", key)