-
Notifications
You must be signed in to change notification settings - Fork 212
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
Add reduce lastvalid timestamp warn logs frequency #1011
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1011 +/- ##
==========================================
+ Coverage 57.58% 63.47% +5.89%
==========================================
Files 370 364 -6
Lines 17548 18726 +1178
==========================================
+ Hits 10105 11887 +1782
+ Misses 6848 6220 -628
- Partials 595 619 +24 ☔ View full report in Codecov by Sentry. |
I don't see any new unit tests. Can you build the agent and verify that the sampling works as intended? |
This PR was marked stale due to lack of activity. |
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) | ||
{ | ||
if time.Since(p.lastWarnMessage) > logWarnInterval { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Combine check with the one above.
@@ -22,6 +22,7 @@ const ( | |||
reqSizeLimit = 1024 * 1024 | |||
reqEventsLimit = 10000 | |||
warnOldTimeStamp = 1 * 24 * time.Hour | |||
logWarnInterval = 1 * 5 * time.Minute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Would rename this to make it clearer that it's related to the old timestamp warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this to
warnOldTimeStampLogInterval = 1 * 5 * time.Minute
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) | ||
// Check when timestamp has an interval of 1 days. | ||
if (time.Since(p.lastUpdateTime) > warnOldTimeStamp) && (time.Since(p.lastWarnMessage) > warnOldTimeStampLogInterval) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Don't need the parentheses.
Description of the issue
CloudWatch Agent introduced a warning log when timestamp falls back to an older valid timestamp #870
This log isn't throttled and can produce excessive warning logs when timestamp isn't parsing
Description of changes
Set the warning log message to print per set interval time
License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Tests
Manually tested confirmed warning log prints per set interval (default 5 minutes)
Requirements
Before commit the code, please do the following steps.
make fmt
andmake fmt-sh
make lint