-
Notifications
You must be signed in to change notification settings - Fork 8
perf: Enable compression of audit logs to increase retention, without changing disk space requirements #1270
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
Conversation
|
With the current configuration, we have 1 log file of 100MB, and 10 rotated log files of 100MB each, for a total of 1100MB. That's our target disk space requirement. We want to keep this disk space usage, but enable compression. We can't just make the maximum file size larger. For example, if we increase it to 1000MB, then we'll end up with 1 1000MB log, plus 10 compressed, rotated logs of approximately 100MB each, for a total of 2000MB, much higher than our target. To increase retention, we should reduce the size of the uncompressed log. For example, we could keep |
4e92564 to
55978d5
Compare
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.
Thanks!
55978d5 to
a904f0b
Compare
We enable compression of audit logs. Whenever a log file is rotated, it is compressed. Experiments show that gzip yields a compression factor of approximately 12 for audit logs, so we increase the maximum file size by that factor. With the previous configuration, we had 1 log file of 100MB, and 10 rotated log files of 100MB each, for a total of 1100MB. That's our target disk space requirement. We want to keep this disk space usage, but enable compression. We can't just make the maximum file size larger. For example, if we increase it to 1000MB, then we'll end up with 1 1000MB log, plus 10 compressed, rotated logs of approximately 100MB each, for a total of 2000MB, much higher than our target. To increase retention, we reduce the size of the uncompressed log. We keep --audit-log-maxsize unchanged at 100, but increase --audit-log-maxbackup to 90. We end up with 1 100MB uncompressed log, plus 90 compressed, rotated logs of approximately 10MB each, for a total of 1000MB. That's a little below our target!
a904f0b to
5910b9c
Compare
What problem does this PR solve?:
Given our disk space requirements (about 1GB), the audit logs hold about 1-2 hours. By enabling compression, we can increase this by a factor of 12, i.e. 12-24 hours.
In this PR, we enable compression of audit logs. Whenever a log file is rotated, it is compressed.
Experiments show that gzip yields a compression factor of approximately 12 for audit logs, so we increase the maximum file size by that factor. We expect disk space requirements to remain the same.
Which issue(s) this PR fixes:
Fixes #
How Has This Been Tested?:
Special notes for your reviewer:
fluent-bit should continue to work, because it supports reading log files compressed using gzip as of fluent/fluent-bit#8585, released in https://github.com/fluent/fluent-bit/releases/tag/v3.0.0.
However, I need to verify this!