log rotate task: make task archive limits be binary based

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-11-02 19:31:56 +01:00
parent 72aa1834dc
commit b7f2be5137
1 changed files with 2 additions and 3 deletions

View File

@ -522,9 +522,8 @@ async fn schedule_task_log_rotate() {
worker.log(format!("starting task log rotation")); worker.log(format!("starting task log rotation"));
let result = try_block!({ let result = try_block!({
// rotate task log archive let max_size = 512 * 1024 - 1; // an entry has ~ 100b, so > 5000 entries/file
let max_size = 500000; // a normal entry has about 100b, so ~ 5000 entries/file let max_files = 20; // times twenty files gives > 100000 task entries
let max_files = 20; // times twenty files gives at least 100000 task entries
let has_rotated = rotate_task_log_archive(max_size, true, Some(max_files))?; let has_rotated = rotate_task_log_archive(max_size, true, Some(max_files))?;
if has_rotated { if has_rotated {
worker.log(format!("task log archive was rotated")); worker.log(format!("task log archive was rotated"));