Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default timestamp_format to be compatible with zero padding and non zero padding #870

Merged
merged 18 commits into from
Oct 16, 2023
Merged
10 changes: 5 additions & 5 deletions plugins/outputs/cloudwatchlogs/pusher.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
)

const (
reqSizeLimit = 1024 * 1024
reqEventsLimit = 10000
logWarnInterval = 1 * 24 * time.Hour
reqSizeLimit = 1024 * 1024
reqEventsLimit = 10000
warnOldTimeStamp = 1 * 24 * time.Hour
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nit: Still think threshold should be somewhere in the name, but it isn't blocking.

)

var (
Expand Down Expand Up @@ -417,8 +417,8 @@ func (p *pusher) convertEvent(e logs.LogEvent) *cloudwatchlogs.InputLogEvent {
t = p.lastValidTime
if !p.lastUpdateTime.IsZero() {
// Check when timestamp has an interval of 5 days.
if time.Since(p.lastUpdateTime) > logWarnInterval {
p.Log.Warnf("Unable to parse timestamp, using last valid timestamp %v: which is at least older by 1 day for log group %v: ", p.lastValidTime, p.Group)
if time.Since(p.lastUpdateTime) > warnOldTimeStamp {
p.Log.Warnf("Unable to parse timestamp, using last valid timestamp found in the logs %v: which is at least older than 1 day for log group %v: ", p.lastValidTime, p.Group)
}
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
log_group_name = "amazon-cloudwatch-agent.log"
pipe = false
retention_in_days = -1
timestamp_layout = "15:04:05 06 Jan 02"
timestamp_regex = "(d{2}:d{2}:d{2} d{2} w{3} d{2})"
timestamp_layout = ["15:04:05 06 Jan _2"]
timestamp_regex = "(d{2}:d{2}:d{2} d{2} w{3} s{0,1} d{1,2})"

[outputs]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
log_group_name = "amazon-cloudwatch-agent.log"
pipe = false
retention_in_days = -1
timestamp_layout = "15:04:05 06 Jan 02"
timestamp_regex = "(d{2}:d{2}:d{2} d{2} w{3} d{2})"
timestamp_layout = ["15:04:05 06 Jan _2"]
timestamp_regex = "(d{2}:d{2}:d{2} d{2} w{3} s{0,1} d{1,2})"

[outputs]

Expand Down