diff --git a/packages/backend-core/src/logging/system.ts b/packages/backend-core/src/logging/system.ts index 9a32b69a9f..d918c6efd6 100644 --- a/packages/backend-core/src/logging/system.ts +++ b/packages/backend-core/src/logging/system.ts @@ -45,7 +45,7 @@ export function getSingleFileMaxSizeInfo(totalMaxSize: string) { return { size: `${size / 2}${unit}`, totalHistoryFiles: 1 } } - return { size: `1${unit}`, totalHistoryFiles: size } + return { size: `1${unit}`, totalHistoryFiles: size - 1 } } export function localFileDestination() { diff --git a/packages/backend-core/src/logging/tests/system.spec.ts b/packages/backend-core/src/logging/tests/system.spec.ts index f756d59e2b..b84d8e8456 100644 --- a/packages/backend-core/src/logging/tests/system.spec.ts +++ b/packages/backend-core/src/logging/tests/system.spec.ts @@ -19,12 +19,12 @@ describe("system", () => { ) it.each([ - ["5B", "1B", 5], - ["17K", "1K", 17], - ["21M", "1M", 21], - ["3G", "1G", 3], + ["5B", "1B", 4], + ["17K", "1K", 16], + ["21M", "1M", 20], + ["3G", "1G", 2], ])( - "Halving an odd number (%s) returns as many files as size (%s)", + "Halving an odd number (%s) returns as many files as size (-1) (%s)", (totalValue, expectedMaxSize, totalHistoryFiles) => { const result = getSingleFileMaxSizeInfo(totalValue) expect(result).toEqual({