diff --git a/config/logs.go b/config/logs.go index d0606baa..310755f0 100644 --- a/config/logs.go +++ b/config/logs.go @@ -32,7 +32,7 @@ type ( ContainerExclude []string `json:"container_exclude" toml:"container_exclude"` GlobalProcessingRules []*logsconfig.ProcessingRule `json:"processing_rules" toml:"processing_rules"` Items []*logsconfig.LogsConfig `json:"items" toml:"items"` - Precision string `toml:"precision" json:"precision"` + Accuracy string `toml:"accuracy" json:"accuracy"` KafkaConfig KubeConfig } diff --git a/config/logs/integration_config.go b/config/logs/integration_config.go index 76fb57ef..a6b9dd91 100644 --- a/config/logs/integration_config.go +++ b/config/logs/integration_config.go @@ -49,7 +49,7 @@ type ( IdleTimeout string `mapstructure:"idle_timeout" json:"idle_timeout" toml:"idle_timeout"` // Network Path string // File, Journald Topic string `mapstructure:"topic" json:"topic" toml:"topic"` - Precision string `mapstructure:"precision" json:"precision" toml:"precision"` + Accuracy string `mapstructure:"accuracy" json:"accuracy" toml:"accuracy"` Encoding string `mapstructure:"encoding" json:"encoding" toml:"encoding"` // File ExcludePaths []string `mapstructure:"exclude_paths" json:"exclude_paths" toml:"exclude_paths"` // File diff --git a/logs/processor/json.go b/logs/processor/json.go index caa4f987..8ee5639a 100644 --- a/logs/processor/json.go +++ b/logs/processor/json.go @@ -41,20 +41,19 @@ func (j *jsonEncoder) Encode(msg *message.Message, redactedMsg []byte) ([]byte, if !msg.Timestamp.IsZero() { ts = msg.Timestamp } - precision := config.Config.Logs.Precision - if msg.Origin.LogSource.Config.Precision != "" { - precision = msg.Origin.LogSource.Config.Precision + accuracy := config.Config.Logs.Accuracy + if msg.Origin.LogSource.Config.Accuracy != "" { + accuracy = msg.Origin.LogSource.Config.Accuracy } - if precision == "" { - precision = "ms" + if accuracy == "" { + accuracy = "ms" } timestamp := ts.UnixMilli() - switch precision { + switch accuracy { case "s": - timestamp = timestamp / 1000 * 1000 + timestamp = timestamp / 1000 case "m": - ts := timestamp / 1000 * 1000 // ms - timestamp = ts - ts%60000 + timestamp = timestamp / 60000 } topic := config.Config.Logs.Topic if msg.Origin.LogSource.Config.Topic != "" {