Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Compress logs during rotation #7430
Conversation
howbazaar
added some commits
May 31, 2017
|
To run the CI test, I had to do the following:
|
|
acceptancetests changes look good to me. |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
| @@ -158,9 +158,9 @@ def check_expected_backup(key, logprefix, action_output): | ||
| (log_name, backup_pattern)) | ||
| size = int(log["size"]) | ||
| - if size < 299 or size > 301: | ||
| + if size > 30: |
4a6f656c
Jun 1, 2017
Contributor
As an aside, it could be worth checking both the compressed version, then decompressing it and checking the uncompressed version.. this also has the advantage of ensuring that the log format is understood and decompressable.
| @@ -148,7 +148,7 @@ def check_expected_backup(key, logprefix, action_output): | ||
| raise LogRotateError( | ||
| "Missing backup log '{}' after rotation.".format(key)) | ||
| - backup_pattern = "/var/log/juju/%s-(.+?)\.log" % logprefix | ||
| + backup_pattern = "/var/log/juju/%s-(.+?)\.log.gz" % logprefix |
jameinel
Jun 1, 2017
Owner
this feels like it should be .log(.gz)?
something that says we might see it as .log or .log.gz
| raise LogRotateError( | ||
| - "Backup log '%s' should be ~300MB, but is %sMB." % | ||
| + "Backup log '%s' should be less than 30MB (as gzipped), but is %sMB." % |
|
Build failed: Tests failed |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
|
Build failed: Tests failed |
|
$$scream$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
howbazaar commentedJun 1, 2017
Description of change
Rotated logs take up a significant amount of disk space, and compressing the logs has been long asked for. Yesterday lumberjack acquired a fix that adds a Compress flag to the configuration struct.
This branch sets that flag, updates the dependency for lumberjack, and fixes the CI tests for log rotation.
QA steps
Manually, I bootstrapped a lxd provider, deployed the fill-logs charm from the CI tests, and ran the fill-logs-units action, and observed compressed logs. I also deployed an older Juju, made sure there were already rotated logs that were uncompressed, then upgraded juju, then forced another rotate, and observed that all existing logs were also compressed.
Documentation changes
I'm not sure it is documentation worthy.
Bug reference
https://bugs.launchpad.net/juju/+bug/1494661