Fix duplicate retention case
Description of the issue
[todo] https://github.com/aws/amazon-cloudwatch-agent/issues/554
Description of changes
When the same retention is set multiple times for a log group, retention will be set as long as any file_path is created for that log group.
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
Describe what tests you have done.
Requirements
Before commit the code, please do the following steps.
- Run
make fmtandmake fmt-sh - Run
make linter
Codecov Report
Merging #556 (96c3bce) into master (e571562) will decrease coverage by
0.54%. The diff coverage is61.90%.
@@ Coverage Diff @@
## master #556 +/- ##
==========================================
- Coverage 57.15% 56.61% -0.55%
==========================================
Files 362 375 +13
Lines 16868 17839 +971
==========================================
+ Hits 9641 10099 +458
- Misses 6676 7148 +472
- Partials 551 592 +41
| Impacted Files | Coverage Δ | |
|---|---|---|
| logs/logs.go | 20.25% <61.90%> (ø) |
|
| plugins/inputs/win_perf_counters/pdh.go | 65.47% <0.00%> (ø) |
|
| translator/util/platform_windows.go | 75.00% <0.00%> (ø) |
|
| ...puts/logfile/tail/file_deleting_checker_windows.go | 36.36% <0.00%> (ø) |
|
| ...gins/inputs/windows_event_log/wineventlog/utils.go | 69.60% <0.00%> (ø) |
|
| ...windows_event_log/wineventlog/wineventlogrecord.go | 59.09% <0.00%> (ø) |
|
| ...gins/inputs/windows_event_log/windows_event_log.go | 26.08% <0.00%> (ø) |
|
| plugins/inputs/logfile/tail/tail_windows.go | 100.00% <0.00%> (ø) |
|
| ...nputs/windows_event_log/wineventlog/wineventlog.go | 36.32% <0.00%> (ø) |
|
| ... and 7 more |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
Is there backwards compatibility with the old way that we configured?
We can't afford to break backwards-compatibility. What happens if we take an example config where there's multiple configs pointing to the same log group and only one of the configs has a retention policy (existing behavior)? Can you build this and manually verify that behavior works?
Yes backwards compatibility still maintained: if the customer has multiple streams for a log_group and retention only configured in one, it will still successfully update the retention. Note the 2 configs pointing to the same log group amazon-cloudwatch-agent.log with only 1 of them having retention in days.
