Enable logging in n8n by setting the N8N_LOG_LEVEL environment variable to debug, info, warn, or error. You can output logs to the console or a file by configuring N8N_LOG_OUTPUT and N8N_LOG_FILE_LOCATION. This helps you trace workflow failures, API errors, and node execution issues in real time.
Why Enable Logging in n8n
By default, n8n only logs errors to the console. When workflows fail silently or nodes return unexpected results, you need more visibility. Enabling detailed logging lets you see every HTTP request, credential lookup, and node execution step. This is essential for debugging production workflows, diagnosing API connectivity issues, and understanding why triggers are not firing. n8n supports four log levels and two output targets, giving you full control over verbosity and storage.
Prerequisites
- A running self-hosted n8n instance (npm or Docker)
- Access to the server terminal or Docker configuration
- Basic familiarity with environment variables
- Permission to restart the n8n process
Step-by-step guide
Set the log level environment variable
Set the log level environment variable
n8n reads the N8N_LOG_LEVEL environment variable at startup. The four levels are error (least verbose), warn, info, and debug (most verbose). For troubleshooting, start with info to see execution flow without overwhelming detail. Use debug only when you need to inspect HTTP request bodies and credential resolution. Set the variable before starting n8n. On Linux or macOS, export it in your shell session or add it to your .env file.
1# Set log level to info (recommended for troubleshooting)2export N8N_LOG_LEVEL=info34# Or for maximum detail during debugging5export N8N_LOG_LEVEL=debug67# Then start n8n8n8n startExpected result: n8n starts and prints detailed log messages to the console, including node execution events and HTTP request details.
Configure log output to a file
Configure log output to a file
By default, logs go to the console (stdout). For production use, write logs to a file so you can search them later. Set N8N_LOG_OUTPUT to file and specify the file path with N8N_LOG_FILE_LOCATION. You can also set the output to both console and file by using a comma-separated value. Make sure the directory exists and n8n has write permissions.
1# Log to a file2export N8N_LOG_OUTPUT=file3export N8N_LOG_FILE_LOCATION=/var/log/n8n/n8n.log45# Or log to both console and file6export N8N_LOG_OUTPUT=console,file7export N8N_LOG_FILE_LOCATION=/var/log/n8n/n8n.log89# Create the log directory10mkdir -p /var/log/n8n1112n8n startExpected result: n8n writes structured log entries to /var/log/n8n/n8n.log. Each entry includes a timestamp, log level, and message.
Configure logging in Docker
Configure logging in Docker
When running n8n in Docker, pass environment variables via the -e flag or a docker-compose.yml file. The Docker approach is the most common for production deployments. Mount a host directory for the log file so logs persist across container restarts.
1# Docker run with logging2docker run -d \3 --name n8n \4 -p 5678:5678 \5 -e N8N_LOG_LEVEL=info \6 -e N8N_LOG_OUTPUT=console,file \7 -e N8N_LOG_FILE_LOCATION=/home/node/.n8n/logs/n8n.log \8 -v n8n_data:/home/node/.n8n \9 docker.n8n.io/n8nio/n8nExpected result: The n8n container starts with info-level logging. Logs appear in docker logs output and are also written to the mounted volume.
Configure logging in docker-compose
Configure logging in docker-compose
For docker-compose setups, add the environment variables to your compose file. This is cleaner than passing multiple -e flags and makes your configuration version-controlled. Create a dedicated volume for logs so they survive container recreation.
1# docker-compose.yml2version: '3.8'3services:4 n8n:5 image: docker.n8n.io/n8nio/n8n6 ports:7 - '5678:5678'8 environment:9 - N8N_LOG_LEVEL=info10 - N8N_LOG_OUTPUT=console,file11 - N8N_LOG_FILE_LOCATION=/home/node/.n8n/logs/n8n.log12 volumes:13 - n8n_data:/home/node/.n8n1415volumes:16 n8n_data:Expected result: Running docker-compose up -d starts n8n with persistent file logging. Logs are stored inside the n8n_data volume.
Read and interpret log entries
Read and interpret log entries
Once logging is enabled, you need to know what to look for. n8n logs include the timestamp, level, component, and message. Look for ERROR entries to find failures, and INFO entries to trace execution flow. When debugging a specific workflow, search for the workflow ID or execution ID in the logs. The debug level includes HTTP request and response bodies, which is useful for diagnosing API errors.
1# View the last 50 lines of the log file2tail -50 /var/log/n8n/n8n.log34# Follow logs in real time5tail -f /var/log/n8n/n8n.log67# Search for errors8grep 'ERROR' /var/log/n8n/n8n.log910# Search for a specific workflow execution11grep 'workflowId=123' /var/log/n8n/n8n.logExpected result: You can see structured log entries with timestamps. ERROR lines highlight failures with stack traces. INFO lines show the execution flow for each workflow run.
Complete working example
1# docker-compose.yml — n8n with full logging configuration2version: '3.8'34services:5 n8n:6 image: docker.n8n.io/n8nio/n8n7 restart: unless-stopped8 ports:9 - '5678:5678'10 environment:11 # Logging configuration12 - N8N_LOG_LEVEL=info13 - N8N_LOG_OUTPUT=console,file14 - N8N_LOG_FILE_LOCATION=/home/node/.n8n/logs/n8n.log15 # General configuration16 - N8N_HOST=0.0.0.017 - N8N_PORT=567818 - N8N_PROTOCOL=https19 - WEBHOOK_URL=https://n8n.example.com/20 # Database (optional — defaults to SQLite)21 - DB_TYPE=sqlite22 - DB_SQLITE_VACUUM_ON_STARTUP=true23 volumes:24 - n8n_data:/home/node/.n8n25 healthcheck:26 test: ['CMD', 'wget', '--spider', '-q', 'http://localhost:5678/healthz']27 interval: 30s28 timeout: 5s29 retries: 33031volumes:32 n8n_data:33 driver: localCommon mistakes when enabling Logging in n8n
Why it's a problem: Leaving N8N_LOG_LEVEL=debug in production permanently
How to avoid: Switch to info or warn after troubleshooting. Debug logs include sensitive data like API keys and request bodies.
Why it's a problem: Forgetting to create the log directory before starting n8n
How to avoid: Run mkdir -p /var/log/n8n (or the chosen path) and ensure the n8n user has write permissions.
Why it's a problem: Not restarting n8n after changing environment variables
How to avoid: n8n reads environment variables at startup. You must restart the process or container for changes to take effect.
Why it's a problem: Log file grows until the disk is full
How to avoid: Configure logrotate to rotate and compress logs daily. Example: /var/log/n8n/*.log { daily rotate 7 compress }.
Best practices
- Use info level for production monitoring and debug only for active troubleshooting sessions
- Always configure file logging in production so you can review logs after an incident
- Set up log rotation with logrotate or a similar tool to prevent disk space exhaustion
- Include the workflow ID in your log searches to isolate issues to a specific workflow
- Switch back to warn or error level after debugging to reduce log noise and disk usage
- Mount log directories as persistent volumes in Docker so logs survive container restarts
- Use docker logs --tail 200 -f n8n for quick real-time debugging without file logging
- Combine n8n logs with a log aggregator like Loki or the ELK stack for searchable history
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I'm running n8n self-hosted and my workflows are failing silently. How do I enable info-level logging with output to both console and a file? Show me the environment variables and a docker-compose example.
My n8n workflows are failing but I can't see any error details. Help me configure N8N_LOG_LEVEL and N8N_LOG_OUTPUT to write detailed logs to a file.
Frequently asked questions
What log levels does n8n support?
n8n supports four log levels: error (only errors), warn (errors and warnings), info (execution flow details), and debug (everything including HTTP bodies). Set the level with the N8N_LOG_LEVEL environment variable.
Can I log to both the console and a file at the same time?
Yes. Set N8N_LOG_OUTPUT=console,file and provide a file path via N8N_LOG_FILE_LOCATION. n8n will write to both destinations simultaneously.
Do I need to restart n8n after changing log settings?
Yes. n8n reads environment variables at startup only. After changing N8N_LOG_LEVEL or N8N_LOG_OUTPUT, restart the process or container for the new settings to take effect.
Does debug logging expose sensitive data?
Yes. Debug-level logs can include API keys, request bodies, and credential details. Only use debug for active troubleshooting and switch back to info or warn afterward.
How do I enable logging in n8n Cloud?
n8n Cloud does not expose server-level logging configuration. Use the Executions tab in the UI to inspect workflow runs. For full log access, use a self-hosted n8n deployment.
Where does n8n write logs by default?
By default, n8n writes logs to the console (stdout) at the error level. No file logging is configured unless you set N8N_LOG_OUTPUT=file and provide N8N_LOG_FILE_LOCATION.
Can RapidDev help me set up n8n logging and monitoring?
Yes. RapidDev can configure production-grade logging with log rotation, centralized aggregation, and alerting for your n8n deployment. Contact RapidDev for a free consultation.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation