Skip to content

日志环境变量(Logs environment variables)#

File-based configuration

You can add _FILE to individual variables to provide their configuration in a separate file. Refer to Keeping sensitive data in separate files for more details.

本页面列出了用于设置调试日志记录的环境变量。详细信息请参阅 n8n 日志记录

🌐 This page lists environment variables to set up logging for debugging. Refer to Logging in n8n for details.

n8n 日志(n8n logs)#

Variable Type Default Description
N8N_LOG_LEVEL Enum string: info, warn, error, debug info Log output level. Refer to Log levels for details.
N8N_LOG_OUTPUT Enum string: console, file console Where to output logs. Provide multiple values as a comma-separated list.
N8N_LOG_FORMAT Enum string: text, json text The log format to use. text prints human readable messages. json prints one JSON object per line containing the message, level, timestamp, and all metadata. This is useful for production monitoring as well as debugging.
N8N_LOG_CRON_ACTIVE_INTERVAL Number 0 Interval in minutes to log currently active cron jobs. Set to 0 to disable.
N8N_LOG_FILE_COUNT_MAX Number 100 Max number of log files to keep.
N8N_LOG_FILE_SIZE_MAX Number 16 Max size of each log file in MB.
N8N_LOG_FILE_LOCATION String <n8n-directory-path>/logs/n8n.log Log file location. Requires N8N_LOG_OUTPUT set to file.
DB_LOGGING_ENABLED Boolean false Whether to enable database-specific logging.
DB_LOGGING_OPTIONS Enum string: query, error, schema, warn, info, log error Database log output level. To enable all logging, specify all. Refer to TypeORM logging options
DB_LOGGING_MAX_EXECUTION_TIME Number 1000 Maximum execution time (in milliseconds) before n8n logs a warning. Set to 0 to disable long running query warning.
CODE_ENABLE_STDOUT Boolean false Set to true to send Code node logs from console.log or print to the process's stdout, only for production executions.
NO_COLOR any undefined Set to any value to output logs without ANSI colors. For more information, see the no-color.org website.

日志流(Log streaming)#

有关此功能的更多信息,请参阅日志流

🌐 Refer to Log streaming for more information on this feature.

变量 类型 默认值 描述
N8N_EVENTBUS_CHECKUNSENTINTERVAL 数字 0 检查未发送事件消息的频率(以毫秒为单位)。在极少数情况下可能会发送两次消息。设置为 0 可禁用。
N8N_EVENTBUS_LOGWRITER_SYNCFILEACCESS 布尔值 false 是否所有文件访问都在该线程内同步进行(true)还是不同步(false)。
N8N_EVENTBUS_LOGWRITER_KEEPLOGCOUNT 数字 3 保留的事件日志文件数量。
N8N_EVENTBUS_LOGWRITER_MAXFILESIZEINKB 数字 10240 事件日志文件达到最大大小(以千字节为单位)后开始新文件。
N8N_EVENTBUS_LOGWRITER_LOGBASENAME 字符串 n8nEventLog 事件日志文件的基本名称。

从环境变量管理日志流目标(Manage log streaming destinations from environment variables)#

N8N_LOG_STREAMING_MANAGED_BY_ENV 设置为 true 以从环境变量管理日志流目的地。请参阅 使用环境变量管理实例设置 了解激活模式的工作原理,以及 使用环境变量配置日志流目的地 了解每个目的地的 JSON 结构。

🌐 Set N8N_LOG_STREAMING_MANAGED_BY_ENV to true to manage log streaming destinations from environment variables. See Manage instance settings using environment variables for how the activation pattern works, and Configure log streaming destinations using environment variables for the per-destination JSON shape.

Variable Type Default Description
N8N_LOG_STREAMING_MANAGED_BY_ENV Boolean false Set to true to manage log streaming from environment variables. When true, n8n applies the log streaming variables on every startup and locks the matching UI controls.
N8N_LOG_STREAMING_DESTINATIONS JSON string - JSON array of log streaming destinations. Each destination is an object with a type of webhook, syslog, or sentry, plus the configuration for that type.