How to set up log streaming monitoring on n8n
Set up log streaming monitoring on n8n by configuring environment variables for log levels, enabling JSON logging format, and optionally connecting to external services like Elasticsearch or Grafana. This enables real-time monitoring of workflow executions and system events.
Prerequisites
- n8n instance running
- Admin access to n8n
- Basic understanding of logging systems
- External log management service (optional)
Step-by-Step Instructions
Configure Environment Variables for Logging
N8N_LOG_LEVEL=debug for detailed logging or N8N_LOG_LEVEL=info for standard monitoring. Set N8N_LOG_OUTPUT=json to enable structured JSON logging format which is essential for log streaming and parsing.Enable Workflow Execution Logging
N8N_LOG_WORKFLOWS=true to log workflow start/end events. Set N8N_EXECUTIONS_DATA_SAVE_ON_SUCCESS=all and N8N_EXECUTIONS_DATA_SAVE_ON_ERROR=all to capture execution data for monitoring purposes.Set Up Log File Configuration
N8N_LOG_FILE_LOCATION=/var/log/n8n/n8n.log to specify log file path. Create the directory with mkdir -p /var/log/n8n and ensure n8n has write permissions. Set N8N_LOG_FILE_SIZE_MAX=10m and N8N_LOG_FILES_COUNT=5 for log rotation.Configure External Log Shipping
filebeat.inputs to monitor /var/log/n8n/*.log and set output to your preferred destination (Elasticsearch, Logstash, or cloud logging service).Set Up Real-time Monitoring Dashboard
Configure Webhook Notifications
Test and Validate Log Streaming
Implement Log Retention Policies
Common Issues & Troubleshooting
Logs not appearing in external system
Check log shipper configuration and network connectivity. Verify n8n is actually writing to log files with tail -f /var/log/n8n/n8n.log. Ensure log shipper has read permissions on log files.
Too many logs causing performance issues
Reduce log level from debug to info or warn. Implement log filtering in your shipper configuration to exclude verbose but non-critical messages. Consider sampling high-volume log events.
JSON log format not parsing correctly
Verify N8N_LOG_OUTPUT=json is set correctly and restart n8n. Check for any custom logging middleware that might interfere with JSON formatting. Update log parser configuration in your monitoring system.
Missing workflow execution logs
Ensure N8N_LOG_WORKFLOWS=true is set and verify workflow logging is enabled in n8n settings. Check that execution data saving is configured properly. Restart n8n after configuration changes.