
Module 11 Lesson 4: Auditing & Logging
Who did what? Learn how to use n8n's execution history and audit logs to track credential usage, data flow, and potential security incidents.
Module 11 Lesson 4: Auditing & Logging
In a production environment, "I don't know" is not an acceptable answer. When a customer's data is mismanaged, you need an Audit Trail to see which workflow, which node, and which user was involved.
1. Execution History (The "Time Machine")
Found in the sidebar. Every time a workflow runs, n8n saves:
- The exact time.
- The status (Success/Failed).
- The Data Payload (the JSON) at every step.
- Security Check: You can choose to "Save executions" only for failed runs to save space, but "All runs" is best for auditing purposes.
2. The "Audit Log" (Enterprise)
On the n8n Enterprise plan, you get a dedicated Audit Log UI.
- It shows: "User A added a new Credential for Gmail."
- "User B deleted Workflow 'Payrolls'."
- "Admin changed the Global Encryption Key."
3. Credential Usage Tracking
You can see which workflows are using which credentials.
- Before you delete a "Stale" API key, check if it's currently "Linked" to any active automation. This prevents accidental breakages.
4. The "Data Retention" Policy
Storing 1,000,000 executions will fill up your hard drive and make n8n slow.
- Policy: "Keep 'Error' logs for 30 days, 'Success' logs for 7 days."
- Set this in the Workflow Settings or globally via environment variables.
Exercise: The Execution Investigator
- Go to your Executions tab. Find a successful run from yesterday.
- Can you see the exact message that was sent to Slack?
- What is the danger of "Saving All Executions" if your workflow handles sensitive passwords or credit card numbers? (Hint: The data is visible to anyone with Admin access to n8n).
- Read: How to use the
EXECUTIONS_DATA_MAX_AGEenvironment variable to automate log cleaning. - Research: What is "External Logging" (e.g., sending n8n logs to Datadog or ELK)?
Summary
Auditing is the "Proof of Performance." By maintaining clean, accessible logs of everything that happens inside n8n, you protect your company from liability and provide your team with the data they need to troubleshoot and improve their work.
Next Lesson: Global rules: Compliance and Privacy (GDPR in Automation).