Skip to content

QDB-15860 - Log rotation hotfix#22

Open
voodoo144 wants to merge 4 commits intomasterfrom
sc-15860/log-rotation-hotfix
Open

QDB-15860 - Log rotation hotfix#22
voodoo144 wants to merge 4 commits intomasterfrom
sc-15860/log-rotation-hotfix

Conversation

@voodoo144
Copy link
Collaborator

@voodoo144 voodoo144 commented Apr 30, 2025

Changes for log rotation to address issue found in QA.

  1. Properties were renamed to reflect units they are using
  2. MaxAge behavior changed to rotate file based on time.

After that change we support log rotation based on time and size.

Priority for rotations:

  1. Size
  2. Time

@voodoo144 voodoo144 requested a review from solatis April 30, 2025 04:08
@solatis
Copy link
Contributor

solatis commented Apr 30, 2025

This is now verified to address the earlier mentioned issues of rotation based on size or time not working?

@solatis solatis changed the title SC-15860: log rotation hotfix QDB-15860 - Log rotation hotfix May 5, 2025
Copy link
Contributor

@solatis solatis left a comment

Choose a reason for hiding this comment

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

Pre-approved, minor comments.

One question I would have is future compatibility -- we effectively vendored and started customizing the lumberjack library, is that correct? Is there a better approach that does not require us to vendor this library yet still be able to customize this behavior?

// MaxAge is the maximum number of seconds to retain old log files based on the
// timestamp encoded in their filename.
// MaxAge is the maximum number of seconds before log file would be rotated.
//We support rotation on time and on size.
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation incorrect, missing a space

millCh chan bool
startMill sync.Once

lastTimeRotate time.Time
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this initialized as?

Do I also understand correctly that we now effectively both vendored but also customized the lumberjack logging library? How will we handle future updates / bugfixes by upstream?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@solatis you are right we did make changes to lumberjack lib and we significantly changed its behavior for MaxAge param. Unfortunately all updates from upstream needs to be manually validated and manually added to our repo.

@solatis
Copy link
Contributor

solatis commented May 12, 2025

@igorniebylski or @rodp63 or @terngkub -- can you QA this before we merge it into master?

@rodp63
Copy link
Member

rodp63 commented May 13, 2025

LGTM. @solatis after each log entry is written, the rotation conditions (size and time) are evaluated.
If no new logs are written, the time-based rotation isn't triggered, but I think that's ok in this context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants