opentelemetry-collector icon indicating copy to clipboard operation
opentelemetry-collector copied to clipboard

[telemetry] Add log rotation support (#7352)

Open h0cheung opened this issue 1 year ago • 30 comments

Description: Add log rotation support. The logs of otelcol itself will be rotated by lumberjack.

Link to tracking Issue: #7352

Testing: Creating logger with or without rotation, logging with rotation and logging with an old big file are added in unit tests.

I did some simple testing on Linux, macOS, and Windows.

h0cheung avatar Mar 24 '23 11:03 h0cheung

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: h0cheung / name: Howard Cheung (d0cc94f30a801422d9545606c3277925dd7fb918)
  • :white_check_mark: login: djaglowski / name: Daniel Jaglowski (233cbf14e9d2769c21d5226d00c2d956c8559ffb)

This PR was marked stale due to lack of activity. It will be closed in 14 days.

github-actions[bot] avatar Apr 08 '23 03:04 github-actions[bot]

This PR was marked stale due to lack of activity. It will be closed in 14 days.

remove stale

h0cheung avatar Apr 08 '23 14:04 h0cheung

Codecov Report

Attention: Patch coverage is 86.48649% with 10 lines in your changes missing coverage. Please review.

Project coverage is 92.35%. Comparing base (e4a1f5b) to head (233cbf1). Report is 77 commits behind head on main.

Files Patch % Lines
service/telemetry/logger.go 81.25% 6 Missing and 3 partials :warning:
service/telemetry/factory.go 0.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7425      +/-   ##
==========================================
- Coverage   92.53%   92.35%   -0.18%     
==========================================
  Files         388      388              
  Lines       18317    18386      +69     
==========================================
+ Hits        16949    16981      +32     
- Misses       1022     1056      +34     
- Partials      346      349       +3     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Apr 13 '23 14:04 codecov[bot]

I made some updates to pass windows-unittest

h0cheung avatar Apr 17 '23 07:04 h0cheung

This PR was marked stale due to lack of activity. It will be closed in 14 days.

github-actions[bot] avatar May 09 '23 03:05 github-actions[bot]

This PR was marked stale due to lack of activity. It will be closed in 14 days.

remove stale

h0cheung avatar May 22 '23 14:05 h0cheung

This PR was marked stale due to lack of activity. It will be closed in 14 days.

github-actions[bot] avatar Jun 06 '23 03:06 github-actions[bot]

This PR was marked stale due to lack of activity. It will be closed in 14 days.

github-actions[bot] avatar Aug 04 '23 03:08 github-actions[bot]

This PR was marked stale due to lack of activity. It will be closed in 14 days.

remove stale

h0cheung avatar Aug 08 '23 13:08 h0cheung

This PR was marked stale due to lack of activity. It will be closed in 14 days.

github-actions[bot] avatar Aug 24 '23 03:08 github-actions[bot]

This PR was marked stale due to lack of activity. It will be closed in 14 days.

remove stale

h0cheung avatar Sep 01 '23 08:09 h0cheung

This PR was marked stale due to lack of activity. It will be closed in 14 days.

github-actions[bot] avatar Sep 16 '23 03:09 github-actions[bot]

This PR was marked stale due to lack of activity. It will be closed in 14 days.

github-actions[bot] avatar Oct 14 '23 03:10 github-actions[bot]

remove stale

h0cheung avatar Oct 27 '23 04:10 h0cheung

This PR was marked stale due to lack of activity. It will be closed in 14 days.

github-actions[bot] avatar Nov 11 '23 03:11 github-actions[bot]

Closed as inactive. Feel free to reopen if this PR is still being worked on.

github-actions[bot] avatar Nov 26 '23 03:11 github-actions[bot]

Did the log rotation ever make it into the code?

kago-dk avatar Apr 10 '24 22:04 kago-dk

Did the log rotation ever make it into the code?

It did not, but it should in some form. Looks like #7425 still tracks it. cc: @BinaryFissionGames.

djaglowski avatar Apr 15 '24 18:04 djaglowski

Hi @djaglowski I think log rotation is a necessary feature. Is there a plan to merge this PR? Or does this PR need to be perfected?

li-zeyuan avatar Apr 22 '24 02:04 li-zeyuan

I agree @li-zeyuan.

@open-telemetry/collector-maintainers, any concerns in principle with adding log rotation?

From what I can tell this timed out after feedback was implemented, but not re-reivewed. @h0cheung are you willing to reopen this? @atoulme will you revisit your comments to confirm if they were addressed?

djaglowski avatar Apr 22 '24 15:04 djaglowski

I agree @li-zeyuan.

@open-telemetry/collector-maintainers, any concerns in principle with adding log rotation?

From what I can tell this timed out after feedback was implemented, but not re-reivewed. @h0cheung are you willing to reopen this? @atoulme will you revisit your comments to confirm if they were addressed?

Yes. I'd like to continue the work if we can reopen this.

h0cheung avatar Apr 23 '24 09:04 h0cheung

I agree @li-zeyuan. @open-telemetry/collector-maintainers, any concerns in principle with adding log rotation? From what I can tell this timed out after feedback was implemented, but not re-reivewed. @h0cheung are you willing to reopen this? @atoulme will you revisit your comments to confirm if they were addressed?

Yes. I'd like to continue the work if we can reopen this.

@h0cheung Hi brother, can you add repository permission to me? Coding together.

li-zeyuan avatar Apr 25 '24 03:04 li-zeyuan

This PR was marked stale due to lack of activity. It will be closed in 14 days.

github-actions[bot] avatar May 11 '24 03:05 github-actions[bot]

I agree @li-zeyuan. @open-telemetry/collector-maintainers, any concerns in principle with adding log rotation? From what I can tell this timed out after feedback was implemented, but not re-reivewed. @h0cheung are you willing to reopen this? @atoulme will you revisit your comments to confirm if they were addressed?

Yes. I'd like to continue the work if we can reopen this.

@h0cheung Hi brother, can you add repository permission to me? Coding together.

Yes

h0cheung avatar May 14 '24 11:05 h0cheung

This PR was marked stale due to lack of activity. It will be closed in 14 days.

github-actions[bot] avatar May 29 '24 03:05 github-actions[bot]

@li-zeyuan, are you still planning to update this PR?

djaglowski avatar May 29 '24 12:05 djaglowski

@li-zeyuan, are you still planning to update this PR?

There will be no time to update the PR in the next 2 months, but I will keep an eye on this feature.

li-zeyuan avatar May 30 '24 12:05 li-zeyuan

@h0cheung if you'd be willing to grant me access I can update the PR.

djaglowski avatar Jun 11 '24 15:06 djaglowski

@h0cheung if you'd be willing to grant me access I can update the PR.

Thank you so much. It's a bit troublesome for me to deal with the windows-unittest without a Windows device.

h0cheung avatar Jun 11 '24 16:06 h0cheung