Logging
Environment variables are configurable for Directus Business Cloud and Enterprise Cloud projects via our Customer Success team. You can also set environment variables in self-hosted projects.
Variable | Description | Default Value |
---|---|---|
LOG_LEVEL | What level of detail to log. One of fatal , error , warn , info , debug , trace or silent . | info |
LOG_HTTP_IGNORE_PATHS | List of HTTP request paths which should not appear in the log. |
All LOGGER_*
environment variables are passed to the options
configuration of a Pino
instance and all LOGGER_HTTP*
environment variables are passed to the options
configuration of a Pino-http
instance.
Based on your project's needs, you can extend the LOGGER_*
environment variables with any config you need to pass to the logger instance. If a LOGGER_LEVELS
key is added, these values will be passed to the logger frontmatter, as described here. The format for adding LEVELS
values is: LOGGER_LEVELS="trace:DEBUG,debug:DEBUG,info:INFO,warn:WARNING,error:ERROR,fatal:CRITICAL"
Log Retention
Variable | Description | Default Value |
---|---|---|
RETENTION_ENABLED | Whether or not to enable custom data retention settings. false will not delete data. | false |
RETENTION_SCHEDULE | The cron schedule at which to check for removable records, the default is once a day at 00:00. | 0 0 * * * |
RETENTION_BATCH | The maximum number of records to delete in a single query. | 500 |
ACTIVITY_RETENTION | The maximum amount of time to retain directus_activity records or false to disable. This excludes flow logs. | 90d |
REVISIONS_RETENTION | The maximum amount of time to retain directus_revisions records or false to disable. | 90d |
FLOW_LOGS_RETENTION | The maximum amount of time to retain flow logs or false to disable. | 90d |
Realtime Logs
The WebSocket Logs endpoint is accessible at /websocket/logs
. The method of authentication is limited to strict
and the connection will be disconnected when the authentication expires.
Variable | Description | Default Value |
---|---|---|
WEBSOCKETS_LOGS_ENABLED | Whether or not to enable the Logs subscriptions. | true |
WEBSOCKETS_LOGS_LEVEL | What level of detail to stream. One of fatal , error , warn , info , debug , trace or silent . | info |
WEBSOCKETS_LOGS_STYLE | Stream just the message (pretty) or the full JSON log. One of pretty , raw . | pretty |
WEBSOCKETS_LOGS_CONN_LIMIT | How many simultaneous connections are allowed. | Infinity |
Realtime system logs are ephemeral and not stored in the database. They are only available while the realtime connection is active. Refreshing the page will clear the logs.
Enabling Realtime Logs
Realtime system logs rely on WebSockets which are enabled as part of Realtime. To enable this feature:
- Ensure the
WEBSOCKETS_ENABLED
environment variable is set totrue
. - Verify that the
WEBSOCKETS_LOGS_ENABLED
environment variable is set totrue
(it defaults totrue
if not explicitly configured).
Log Levels
Under the hood, Directus uses pino for logging and uses the log levels provided by the library:
Log Level | Numeric Value |
---|---|
trace | 10 |
debug | 20 |
info | 30 |
warn | 40 |
error | 50 |
fatal | 60 |
Searching & Filtering
If running multiple instances of Directus in a horizontally-scaled setup, you can also filter the logs by instance in the System Logs pane.
You can also filter the logs by level, or filter by search terms in the msg
field.