Bug 36325

Summary: Add option to koha-run-backups/koha-dump, to exclude logs
Product: Koha Reporter: Danyon Sewell <danyonsewell>
Component: Command-line UtilitiesAssignee: Danyon Sewell <danyonsewell>
Status: Pushed to main --- QA Contact: Kyle M Hall <kyle>
Severity: enhancement    
Priority: P5 - low CC: david, fridolin.somers, kyle, robin
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36311
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00
Attachments: Bug 36325: Add option to koha-run-backups/koha-dump, to exclude logs
Bug 36325: Add option to koha-run-backups/koha-dump, to exclude logs
Bug 36325: Add option to koha-run-backups/koha-dump, to exclude logs
Bug 36325: Add --exclude-logs option to koha-run-backups
Bug 36325: Add option to koha-run-backups/koha-dump, to exclude logs
Bug 36325: Add --exclude-logs option to koha-run-backups

Description Danyon Sewell 2024-03-15 00:54:32 UTC
Adding an additional option to koha-dump and koha-run-backups to exclude the logs in /var/log/koha/site from the completed backup.
Comment 1 Danyon Sewell 2024-03-15 01:25:39 UTC
Created attachment 163157 [details] [review]
Bug 36325: Add option to koha-run-backups/koha-dump, to exclude logs

Written patch to add flag to both koha-dump and koha-run-backups.

Test plan:
1. do a sudo koha-dump and sudo koha-run-backups and check the contents of the .tar.gz backup in /var/spool/koha/instance/ and verify logs are in there
2. apply this patch
3. this time do sudo koha-dump --exclude-logs and sudo koha-run-backups --exclude-logs and check the contents of the .tar.gz backup in /var/spool/koha/instance and verify nothing from /var/log/koha is in there.

 Current status: ASSIGNED
Comment 2 Danyon Sewell 2024-03-15 01:27:22 UTC
Created attachment 163158 [details] [review]
Bug 36325: Add option to koha-run-backups/koha-dump, to exclude logs

Written patch to add flag to both koha-dump and koha-run-backups.

Test plan:
1. do a sudo koha-dump and sudo koha-run-backups and check the contents of the .tar.gz backup in /var/spool/koha/instance/ and verify logs are in there
2. apply this patch
3. this time do sudo koha-dump --exclude-logs and sudo koha-run-backups --exclude-logs and check the contents of the .tar.gz backup in /var/spool/koha/instance and verify nothing from /var/log/koha is in there.
Comment 3 David Nind 2024-03-23 08:05:13 UTC
Created attachment 163754 [details] [review]
Bug 36325: Add option to koha-run-backups/koha-dump, to exclude logs

Written patch to add flag to both koha-dump and koha-run-backups.

Test plan:
1. do a sudo koha-dump and sudo koha-run-backups and check the contents of the .tar.gz backup in /var/spool/koha/instance/ and verify logs are in there
2. apply this patch
3. this time do sudo koha-dump --exclude-logs and sudo koha-run-backups --exclude-logs and check the contents of the .tar.gz backup in /var/spool/koha/instance and verify nothing from /var/log/koha is in there.

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2024-03-23 08:08:08 UTC
Testing notes (using koha-testing-docker):

1. To extract the files to check for the logs (note: name of file will be different): sudo tar -zxvf /var/spool/koha/kohadev/kohadev-2024-03-23.tar.gz

2. After applying the patch, run a reset_all (so that the new option for the commands are picked up).
Comment 5 Danyon Sewell 2024-03-24 22:30:44 UTC
Created attachment 163760 [details] [review]
Bug 36325: Add --exclude-logs option to koha-run-backups
Comment 6 Kyle M Hall 2024-05-10 15:39:59 UTC
Created attachment 166583 [details] [review]
Bug 36325: Add option to koha-run-backups/koha-dump, to exclude logs

Written patch to add flag to both koha-dump and koha-run-backups.

Test plan:
1. do a sudo koha-dump and sudo koha-run-backups and check the contents of the .tar.gz backup in /var/spool/koha/instance/ and verify logs are in there
2. apply this patch
3. this time do sudo koha-dump --exclude-logs and sudo koha-run-backups --exclude-logs and check the contents of the .tar.gz backup in /var/spool/koha/instance and verify nothing from /var/log/koha is in there.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 7 Kyle M Hall 2024-05-10 15:41:01 UTC
Created attachment 166584 [details] [review]
Bug 36325: Add --exclude-logs option to koha-run-backups

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 8 Katrin Fischer 2024-05-13 12:02:23 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 9 Fridolin Somers 2024-05-29 12:13:34 UTC
+        if [ "$exclude_logs" = "yes" ]; then
+        tar -czf "$metadump" -C / $excludes \
...
+        else
         tar -czf "$metadump" -C / $excludes \

Is the folding correct ?