Backend (server) logs
Accessing via the backend log
In the Global menu, go to Advanced → Backend log. This will display the current backend log (i.e. today's), with the historical information available only on disk (see below). When today's log is larger than 5 MiB, only its last 5 MiB are shown, after a line saying how much was left out; the whole file stays on disk.
The log is colored to make it easier to read: request status codes by class, slow SQL queries, warnings in amber and errors in red. The statement of a slow SQL query is highlighted the same way as in the SQL Console, using the color scheme of code notes (see Color schemes in Code).
A search that the app runs in the background, for example to filter a collection, or that a script runs is followed by a Search: line with its query and the number of notes it returned. The query is highlighted the same way as in a Saved Search. Quick search and saved searches don't add this line.
Interaction since v0.104.0:
- The file can be downloaded as a text file using the button in the Note menu area. The download holds what the log view shows, so for a log larger than 5 MiB, take the file from the disk instead.
- The file can also be searched just like a normal Code note.
Location on the disk
Backend logs are stored on the file system. To find them, open the Data directory, go to the log subdirectory and find the latest log file, e.g. trilium-2022-12-14.log.
In the terminal
The server also prints every log entry to its standard output, which is what docker logs or journalctl show. When that output is a terminal, each entry starts with its time and is colored like the backend log in the app: request status codes by class, slow SQL queries, warnings in yellow and errors in red. The statement of a slow SQL query and the query of a search are shown without syntax highlighting there. The startup banner with the Trilium logo and version information is colored too. Output to a file, a pipe or a container log stays plain text without the time, since those tools add their own.
To turn the colors off in a terminal, set the NO_COLOR environment variable; to force them on elsewhere, set FORCE_COLOR=1.
Reporting backend bugs
You can attach the whole file to the bug report (preferable) or open it and copy-paste only the last lines / lines you believe are relevant.
Customizing the retention of logs
The backend logs are fully managed by the Trilium server. By default the last 90 days worth of logs are kept; the logs older than that are deleted in order to reduce the space consumption.
It's possible to change the retention period by modifying the Configuration (config.ini or environment variables) via the .ini file:
[Logging]
retentionDays=7Or 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