-
Notifications
You must be signed in to change notification settings - Fork 26
[DPE-6662] Fix pgbackrest logs names on logs rotation #939
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 16/edge #939 +/- ##
========================================
Coverage 70.22% 70.22%
========================================
Files 16 16
Lines 3725 3725
Branches 542 542
========================================
Hits 2616 2616
Misses 974 974
Partials 135 135 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The pgBackRest activity (backup creation, stanza initialisation, etc) could take minutes, as a result every minute logs rotation could move the current log A.log to A.log_$date.log and will be moved further as logrorate rule operates all *.log files in the folder: > /var/snap/charmed-postgresql/common/var/log/pgbackrest/*.log { ... It results in: -rw------- 1 postgres postgres 0 Feb 18 09:25 all-server.log -rw------- 1 postgres postgres 0 Feb 18 09:19 all-server.log-20250218_09:18.log -rw------- 1 postgres postgres 0 Feb 18 09:20 all-server.log-20250218_09:18.log-20250218_09:19.log -rw------- 1 postgres postgres 0 Feb 18 09:21 all-server.log-20250218_09:18.log-20250218_09:19.log-20250218_09:20.log -rw------- 1 postgres postgres 0 Feb 18 09:22 all-server.log-20250218_09:18.log-20250218_09:19.log-20250218_09:20.log-20250218_09:21.log -rw------- 1 postgres postgres 0 Feb 18 09:23 all-server.log-20250218_09:18.log-20250218_09:19.log-20250218_09:20.log-20250218_09:21.log-20250218_09:22.log -rw------- 1 postgres postgres 1793 Feb 18 09:24 all-server.log-20250218_09:18.log-20250218_09:19.log-20250218_09:20.log-20250218_09:21.log-20250218_09:22.log-20250218_09:23.log The poposed fix: * move the log file to the new name without .log suffix. * use datetime format matching MySQL charms Example: -rw------- 1 postgres postgres 12 Feb 18 09:28 all-server.log -rw------- 1 postgres postgres 322 Feb 18 09:29 all-server.log-20250218_0918 -rw------- 1 postgres postgres 7344 Feb 18 09:30 all-server.log-20250218_0918
d685717
to
235ab76
Compare
dragomirp
approved these changes
Jun 9, 2025
marceloneppel
approved these changes
Jun 9, 2025
taurus-forever
added a commit
that referenced
this pull request
Jun 9, 2025
The pgBackRest activity (backup creation, stanza initialisation, etc) could take minutes, as a result every minute logs rotation could move the current log A.log to A.log_$date.log and will be moved further as logrorate rule operates all *.log files in the folder: > /var/snap/charmed-postgresql/common/var/log/pgbackrest/*.log { ... It results in: -rw------- 1 postgres postgres 0 Feb 18 09:25 all-server.log -rw------- 1 postgres postgres 0 Feb 18 09:19 all-server.log-20250218_09:18.log -rw------- 1 postgres postgres 0 Feb 18 09:20 all-server.log-20250218_09:18.log-20250218_09:19.log -rw------- 1 postgres postgres 0 Feb 18 09:21 all-server.log-20250218_09:18.log-20250218_09:19.log-20250218_09:20.log -rw------- 1 postgres postgres 0 Feb 18 09:22 all-server.log-20250218_09:18.log-20250218_09:19.log-20250218_09:20.log-20250218_09:21.log -rw------- 1 postgres postgres 0 Feb 18 09:23 all-server.log-20250218_09:18.log-20250218_09:19.log-20250218_09:20.log-20250218_09:21.log-20250218_09:22.log -rw------- 1 postgres postgres 1793 Feb 18 09:24 all-server.log-20250218_09:18.log-20250218_09:19.log-20250218_09:20.log-20250218_09:21.log-20250218_09:22.log-20250218_09:23.log The poposed fix: * move the log file to the new name without .log suffix. * use datetime format matching MySQL charms Example: -rw------- 1 postgres postgres 12 Feb 18 09:28 all-server.log -rw------- 1 postgres postgres 322 Feb 18 09:29 all-server.log-20250218_0918 -rw------- 1 postgres postgres 7344 Feb 18 09:30 all-server.log-20250218_0918 (cherry picked from commit ffa77b2)
2 tasks
taurus-forever
added a commit
that referenced
this pull request
Jun 11, 2025
The pgBackRest activity (backup creation, stanza initialisation, etc) could take minutes, as a result every minute logs rotation could move the current log A.log to A.log_$date.log and will be moved further as logrorate rule operates all *.log files in the folder: > /var/snap/charmed-postgresql/common/var/log/pgbackrest/*.log { ... It results in: -rw------- 1 postgres postgres 0 Feb 18 09:25 all-server.log -rw------- 1 postgres postgres 0 Feb 18 09:19 all-server.log-20250218_09:18.log -rw------- 1 postgres postgres 0 Feb 18 09:20 all-server.log-20250218_09:18.log-20250218_09:19.log -rw------- 1 postgres postgres 0 Feb 18 09:21 all-server.log-20250218_09:18.log-20250218_09:19.log-20250218_09:20.log -rw------- 1 postgres postgres 0 Feb 18 09:22 all-server.log-20250218_09:18.log-20250218_09:19.log-20250218_09:20.log-20250218_09:21.log -rw------- 1 postgres postgres 0 Feb 18 09:23 all-server.log-20250218_09:18.log-20250218_09:19.log-20250218_09:20.log-20250218_09:21.log-20250218_09:22.log -rw------- 1 postgres postgres 1793 Feb 18 09:24 all-server.log-20250218_09:18.log-20250218_09:19.log-20250218_09:20.log-20250218_09:21.log-20250218_09:22.log-20250218_09:23.log The poposed fix: * move the log file to the new name without .log suffix. * use datetime format matching MySQL charms Example: -rw------- 1 postgres postgres 12 Feb 18 09:28 all-server.log -rw------- 1 postgres postgres 322 Feb 18 09:29 all-server.log-20250218_0918 -rw------- 1 postgres postgres 7344 Feb 18 09:30 all-server.log-20250218_0918 (cherry picked from commit ffa77b2)
This was referenced Jun 12, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue
Reported as https://warthogs.atlassian.net/browse/DPE-6662
The pgBackRest activity (backup creation, stanza initialization, etc) could take minutes,
as a result every minute logs rotation could move the current log A.log to A.log_$date.log and
will be moved the next minute further as logrorate rule operates all *.log files in the folder:
It results in:
The same time pgBackRest files names are wide and complex and depends on Juju application name (and more),
therefor there are no K.I.S.S way to reconfigure logrotare rules avoiding
*.log
.Solution
Example:
Checklist