n8n Monitoring & Logging
This guide covers the monitoring and logging capabilities available for the MOOD MNKY n8n integration, including how to track workflow execution, troubleshoot issues, and optimize performance.Monitoring Dashboard
The n8n instance includes a built-in monitoring dashboard that provides real-time insights into workflow execution and system performance.Accessing the Dashboard
- Production: https://mnky-mind-n8n.moodmnky.com/dashboard
- Development: http://localhost:5678/dashboard
Dashboard Components
The monitoring dashboard includes the following key components:- Workflow Overview: Summary of all workflows with status indicators
- Execution History: Recent execution attempts with status and duration
- System Resources: CPU, memory, and disk usage metrics
- Queue Status: Active and pending executions in the processing queue
- Error Summary: Overview of recent errors and exceptions
Execution Monitoring
Viewing Execution History
To view the execution history of a specific workflow:- Navigate to the Workflows page
- Select the workflow you want to monitor
- Click on the “Executions” tab
- View the list of past executions with their status and duration
- ID: Unique identifier for the execution
- Status: Success, Error, Running, or Waiting
- Started: Timestamp when execution began
- Duration: Total execution time
- Mode: Manual, Webhook, or Scheduled
Execution Details
Clicking on an execution ID shows detailed information about that specific run:- Node Execution: Step-by-step execution of each node
- Input/Output Data: Data received and produced by each node
- Errors: Detailed error messages for failed nodes
- Execution Path: Visual representation of the data flow through the workflow
API-Based Monitoring
Retrieving Execution Data
You can monitor workflow executions programmatically using the API:Monitoring Active Executions
To get currently running workflows:Logging System
Log Levels
The n8n service uses the following log levels:| Level | Description | Example |
|---|---|---|
| ERROR | Critical issues that require immediate attention | Workflow failures, authentication errors |
| WARN | Potential issues that don’t cause immediate failures | API rate limiting, slow execution |
| INFO | General operational information | Workflow activations, system status changes |
| DEBUG | Detailed information for troubleshooting | Data processing details, node execution |
| VERBOSE | Highly detailed execution information | Internal state changes, data transformations |
Accessing Logs
Web Interface
Logs can be accessed directly from the n8n interface:- Navigate to Settings > Log
- Set the desired log level using the dropdown
- View real-time log entries as they occur
Container Logs
If running in Docker (production environment):Log Files
Direct file access (development environment):Customizing Logging
The logging configuration can be adjusted using environment variables:Performance Monitoring
Key Metrics
Monitor these metrics to ensure optimal performance:- Execution Time: Time taken for workflows to complete
- Queue Length: Number of pending workflow executions
- Error Rate: Percentage of workflow executions that fail
- Resource Usage: CPU, memory, and network consumption
- API Request Rate: Number of API calls to external services
Performance Dashboard
The performance section of the dashboard provides these metrics:Identifying Performance Bottlenecks
Common techniques to identify performance issues:- Execution Timeline Analysis: Review the time spent in each node
- Resource Usage Correlation: Match slow executions with resource spikes
- External Service Monitoring: Track API response times for dependencies
- Data Volume Assessment: Check if performance issues correlate with data size
Error Tracking and Alerts
Setting Up Error Notifications
Configure notifications for workflow failures:- Navigate to Settings > Workflows
- Configure a workflow to handle errors
- Select notification channels:
- Email notifications
- Slack messages
- Custom webhook endpoints
- SMS (via third-party services)
Error Analysis Dashboard
The error analysis section provides aggregated error information:Creating a Dedicated Error Handling Workflow
Example of an error handling workflow with notifications:Integration with External Monitoring
Prometheus Integration
n8n can expose metrics in Prometheus format for integration with Prometheus monitoring:-
Enable the Prometheus endpoint by setting:
-
Access metrics at:
-
Configure Prometheus to scrape this endpoint:
Grafana Dashboards
Pre-built Grafana dashboards are available for visualizing n8n metrics:- Import the n8n dashboard template from the MOOD MNKY infrastructure repository
- Connect your Grafana instance to the Prometheus data source
- Access comprehensive visualizations including:
- Workflow execution heat maps
- Error rate trends
- Resource usage graphs
- API call volume metrics
ELK Stack Integration
For advanced log analysis, n8n logs can be forwarded to the ELK stack:-
Configure n8n to output JSON-formatted logs:
-
Use Filebeat to ship logs to Elasticsearch:
- Create Kibana dashboards for log visualization and analysis
Audit Logging
Audit Log Configuration
Enable comprehensive audit logging to track all system changes:Tracked Events
The audit log captures these events:- User Actions: Login, logout, failed authentication attempts
- Workflow Changes: Creation, modification, deletion, activation
- Credential Updates: Creation, modification, deletion
- Execution Actions: Manual executions, stopping executions
- System Settings: Configuration changes, user management
Audit Log Format
Each audit log entry follows this format:Best Practices for Monitoring
Monitoring Strategy
Implement these monitoring practices for optimal n8n operations:-
Set Up Multi-level Monitoring:
- System-level monitoring (CPU, memory, disk)
- Application-level monitoring (queue length, execution count)
- Workflow-level monitoring (success rate, execution time)
- Node-level monitoring (error rates, performance)
-
Establish Baselines:
- Document normal performance patterns
- Set thresholds for alerting based on deviations
- Create seasonal baselines for workflows with periodic patterns
-
Implement Proactive Monitoring:
- Create test workflows that run periodically to check system health
- Monitor dependencies and external services
- Set up early warning alerts for potential issues
Performance Optimization
Follow these recommendations to maintain optimal performance:-
Regular Maintenance:
- Prune execution history data regularly
- Archive inactive workflows
- Remove unused credentials
- Update to the latest n8n version
-
Resource Management:
- Schedule resource-intensive workflows during off-peak hours
- Set concurrency limits appropriate for your infrastructure
- Implement backoff strategies for external API calls
- Use batching for large data sets
-
Workflow Optimization:
- Limit data returned by HTTP requests
- Use IF nodes to skip unnecessary processing
- Implement pagination for large data sets
- Use appropriate error handling and retry strategies
Troubleshooting Guide
Common Issues and Solutions
| Issue | Symptoms | Resolution |
|---|---|---|
| Webhook Not Triggering | Webhook calls don’t start workflow execution | Check webhook URL, verify workflow is active, check network access |
| Workflow Stuck | Execution shows as “running” for extended periods | Check for infinite loops, external service availability, increase timeout settings |
| High Memory Usage | System performance degradation, OOM errors | Reduce batch sizes, optimize data handling, increase memory allocation |
| Database Connection Issues | Database operation errors, workflow failures | Verify connection credentials, check database server status, implement retry logic |
| Rate Limiting | API error responses, incomplete data processing | Implement backoff strategies, distribute requests, use bulk operations where possible |
Advanced Debugging
When standard monitoring doesn’t identify the issue:-
Verbose Logging:
-
Node-specific Debugging:
Add a Function node with detailed logging:
-
Isolating Components:
- Create a simplified test workflow with only the problematic nodes
- Execute with controlled test data
- Add intermediary “snapshot” nodes to capture data state
Emergency Response
For critical production issues:-
Immediate Actions:
- Stop affected workflows to prevent cascading failures
- Check for resource exhaustion (CPU, memory, disk)
- Review recent changes or updates that might have caused the issue
-
Communication Protocol:
- Notify the development team through the established channels
- Update status page or monitoring dashboard
- Prepare user communication if service impact is expected
-
Recovery Steps:
- Implement temporary workarounds if available
- Restore from known good configuration if applicable
- Enable additional logging for root cause analysis
- Document the incident for future prevention
Health Checks
Built-in Health Endpoints
n8n provides health check endpoints for monitoring:-
Basic Health Check:
GET /healthzResponse:{"status":"ok"}if the service is running -
Detailed Health Check:
GET /healthResponse includes detailed system status:
Custom Health Check Workflow
Creating a comprehensive health check workflow:Monitoring Dashboard Setup
Setting Up a Custom Dashboard
For organizations requiring a custom monitoring solution:-
Data Collection:
- Use the n8n API to collect execution data
- Set up log forwarding to your monitoring system
- Implement custom health check workflows
-
Visualization Options:
- Grafana dashboards with Prometheus data source
- Custom web dashboard using the n8n API
- Integration with existing monitoring solutions
-
Example Metrics to Track:
- Overall workflow execution success rate
- Average execution time by workflow
- Error frequency by node type
- Resource usage correlation with workflow load
- External service dependency health