-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Update log4j rollover to configure time retention #16179
Conversation
…aints during roll of log files.
Removed grammatical errors and improved readability. Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
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.
LGTM
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.
@andsel, thanks for your work on this. Nice explanations.
I left some suggestions inline to break up the text a bit to make it easier to skim and parse. Please let me know what you think.
Co-authored-by: Karen Metts <35154725+karenzone@users.noreply.github.com>
@karenzone thank's for all your suggestion, accepted in batch 🥇 |
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.
This is looking great. I left some questions about clarifying exactly what we're demonstrating to users here. When I'm clear on what we're doing, I can make some minor tweaks, and we should be able to wrap this up quickly.
When the limit of 30 files has been reached, the first (oldest) file is removed to create space for the new file. | ||
Subsequent files are renumbered accordingly. | ||
|
||
Each file has a date, and files older than 7 days (default) are removed during rollover. |
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.
@andsel If I'm understanding we're saying that we're showing users how to override default settings, but in the example, we're showing default settings. Is that correct?
Can we offer any guidelines on appropriate settings other than recommending that people don't change them?
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.
The intention is to describe what the default settings are and what they accomplish. The second example demonstrates how to switch the strategy to be size-based (the overall file sizes) instead of time-based (the default configuration that roll over after 7 days).
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.
Gotcha. Thank you.
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.
Please consider implementing the suggestion in https://github.com/elastic/logstash/pull/16179/files#r1626121129 to emphasize "maximum number of files." Otherwise, LGTM.
Thanks for your work on this.
Co-authored-by: Karen Metts <35154725+karenzone@users.noreply.github.com>
|
💚 Build Succeeded
History
cc @andsel |
Docs PREVIEW: https://logstash_bk_16179.docs-preview.app.elstc.co/guide/en/logstash/master/logging.html#log4j2
Release notes
Update logging configuration to remove rolled files older than seven days.
What does this PR do?
Updates the plain, json and pipeline appenders in default
config/log4j2.properties
to define a delete rule executed during the rollover strategy, which deletes compressed log archives older than 7 days.Updates the documentation that the describe the logging configuration to explain how the rollover file works, how to configure the strategy in particular how also update to have space limitation condition on the rollover.
Why is it important/What is the impact to the user?
With this commit the user doesn't have anymore problems of disk space exhaustion due to aged log files.
Checklist
[ ] I have commented my code, particularly in hard-to-understand areas[ ] I have added tests that prove my fix is effective or that my feature worksAuthor's Checklist
How to test this PR locally
Change the rollover strategy to use a space limitation (for example 5MB) and use a pipeline that generates log lines, then check that during Logstash execution the files are properly deleted.
Log strategy definition
In
log4j2.properties
replacewith:
Pipeline to generate logs
Launch Logstash with following pipeline:
Then check the content of
logs
folder.Related issues
Use cases
As a user I don't want the archive log files clutter the local filesystem.