From 3ba487bb008108af0ba6512c1cb526eb63967a70 Mon Sep 17 00:00:00 2001 From: "Romain DEP." Date: Wed, 13 Aug 2025 23:35:31 +0200 Subject: [PATCH] feat(logs): provide an option to keep all logs --- apps/server/src/services/log.ts | 3 +++ .../Troubleshooting/Error logs/Backend (server) logs.md | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/server/src/services/log.ts b/apps/server/src/services/log.ts index bcea56500..542b16ad2 100644 --- a/apps/server/src/services/log.ts +++ b/apps/server/src/services/log.ts @@ -38,6 +38,9 @@ async function cleanupOldLogFiles() { const customRetentionDays = config.Logging.retentionDays; if (customRetentionDays > 0) { retentionDays = customRetentionDays; + } else if (customRetentionDays <= -1){ + info(`Log cleanup: keeping all log files, as specified by configuration.`); + return } const cutoffDate = new Date(); diff --git a/docs/User Guide/User Guide/Troubleshooting/Error logs/Backend (server) logs.md b/docs/User Guide/User Guide/Troubleshooting/Error logs/Backend (server) logs.md index 48a248616..641513121 100644 --- a/docs/User Guide/User Guide/Troubleshooting/Error logs/Backend (server) logs.md +++ b/docs/User Guide/User Guide/Troubleshooting/Error logs/Backend (server) logs.md @@ -1,4 +1,4 @@ -# Backend (server) logs +# Backend (server) logs ## Accessing via the backend log In the Global menu, go to Advanced → Show backend log @@ -24,5 +24,11 @@ retentionDays=7 Or via the environment variable `TRILIUM_LOGGING_RETENTION_DAYS`. +Special cases: + +* Positive values indicate the number of days worth of logs to keep +* A value of 0 results with the default value (90 days) to be used +* Negative values (e.g. `-1`) result with all logs to be kept, irrespective how ancient and numerous (and + > [!NOTE] > If you set the retention days to a low number, you might notice that not all the log files are being deleted. This is because a minimum number of logs (7 at the time of writing) is maintained at all times. \ No newline at end of file