Skip to content

Commit 3ba487b

Browse files
committed
feat(logs): provide an option to keep all logs
1 parent 384a89b commit 3ba487b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

apps/server/src/services/log.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ async function cleanupOldLogFiles() {
3838
const customRetentionDays = config.Logging.retentionDays;
3939
if (customRetentionDays > 0) {
4040
retentionDays = customRetentionDays;
41+
} else if (customRetentionDays <= -1){
42+
info(`Log cleanup: keeping all log files, as specified by configuration.`);
43+
return
4144
}
4245

4346
const cutoffDate = new Date();

docs/User Guide/User Guide/Troubleshooting/Error logs/Backend (server) logs.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Backend (server) logs
1+
# Backend (server) logs
22
## Accessing via the backend log
33

44
In the <a class="reference-link" href="../../Basic%20Concepts%20and%20Features/UI%20Elements/Global%20menu.md">Global menu</a>, go to Advanced → Show backend log
@@ -24,5 +24,11 @@ retentionDays=7
2424

2525
Or via the environment variable `TRILIUM_LOGGING_RETENTION_DAYS`.
2626

27+
Special cases:
28+
29+
* Positive values indicate the number of days worth of logs to keep
30+
* A value of 0 results with the default value (90 days) to be used
31+
* Negative values (e.g. `-1`) result with all logs to be kept, irrespective how ancient and numerous (and
32+
2733
> [!NOTE]
2834
> 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.

0 commit comments

Comments
 (0)