This repository has been archived by the owner on Jan 30, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make logrotate aware of disk space #11671
Make logrotate aware of disk space #11671
Changes from all commits
88dbb6c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
If I understand this correctly, we loop over every log file (that is more than 300M), and check if disk space is at >85%. If it is, remove the file. Once we reach <=85%, we won't be removing any more, but we'll still be looping over the rest of the files.
I think it would be logically easier to follow by inverting it like this:
But this is quite nitpicky 😅 also not sure how slow the
find
query is, in which case my suggestion would be less efficient. So happy to leave as-is 👍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.
Yes that's the idea, and I agree the logic of the loop is a bit backward.
The reason for that is mainly to keep it simple as find gives us a nice list to go over in a simple way, using the disk space left to control the loop would make more sense but would introduce more control work as we would need some bit of logic to break the loop if we run out of files to delete.
As it is this we just get a list of files we think we can do something about, work and them, and then we've done what we could to alleviate the space issue.