Skip to main content

Log errors and audit events with n8n Data Tables

Workflow preview

Workflow preview
100%
Log errors and audit events with n8n Data Tables preview
Open on n8n.io

1. Workflow Overview

How it works This workflow provides a reusable error handling, audit logging, and observability pattern for n8n workflows using two n8n custom Data Tables: and . It is designed to be used across mu...

Best for

  • Document Extraction automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.errortrigger, n8n-nodes-base.code, n8n-nodes-base.datatable, n8n-nodes-base.executeworkflowtrigger, n8n-nodes-base.scheduletrigger

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Venkata V.

Original n8n.io source

1.1 Workflow description

Title
Log errors and audit events with n8n Data Tables
Workflow name
Log errors and audit events with n8n Data Tables

How it works

This workflow provides a reusable error handling, audit logging, and observability pattern for n8n workflows using two n8n custom Data Tables: AuditLog and ErrorLog.

It is designed to be used across multiple workflows as a central logging workflow.

At a high level, it:

• Captures unhandled workflow errors using the n8n Error Trigger • Stores technical error details in an ErrorLog Data Table • Allows other workflows to write business/audit events into an AuditLog Data Table • Adds useful observability metadata such as workflow name, workflow ID, execution ID, error message, failed node, severity, and correlation ID • Redacts sensitive values such as passwords, tokens, API keys, and authorization headers before logging • Includes scheduled cleanup logic to purge old log records after a configurable retention period

This template is useful for production-grade n8n setups where multiple workflows need a consistent and reusable logging approach.

Set up steps

Setup should take around 10–15 minutes.

Before using this template:

• Create two n8n Data Tables named AuditLog and ErrorLog • Make sure the table columns match the expected structure described below • Import this workflow into n8n • Re-select your actual Data Tables in the Data Table nodes after import • Set the retention period, for example 90 days, in the configuration node • Activate the workflow • In other workflows, select this workflow as the Error Workflow in Workflow Settings • For audit logging, call this workflow using the Execute Workflow node

No hardcoded API keys are used in this template.

Data Tables used

This template expects two n8n Data Tables.

AuditLog

Column Type
logID String
logType String
logDate Date & Time
WorkflowName String
WorkflowID String
logData String / JSON text

ErrorLog

Column Type
ErrorLogID String
ErrorLogDate Date & Time
ErrorMessage String
WorkflowID String
WorkflowName String
BusinessData String / JSON text

Use Date & Time for logDate and ErrorLogDate.

The workflow writes ISO-8601 timestamps, for example:

2026-04-28T10:30:00.000Z

This allows the purge logic to delete records older than the configured retention period, for example 90 days.

Call from any workflow

Add Execute Workflow node and select this workflow. Send for audit logging:

{
 "logType": "START | SUCCESS | WARNING | BUSINESS_ERROR",
 "workflowName": "={{ $workflow.name }}",
 "workflowId": "={{ $workflow.id }}",
 "correlationId": "={{ $execution.id }}",
 "businessKey": "invoice-123",
 "message": "Invoice extracted successfully",
 "payload": { "invoiceNo": "INV-123", "amount": 100 }
}

For automatic failures, configure each workflow setting: Error Workflow = this workflow.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - 📘 README - Observability Core

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Error Trigger - Global

Type / Role
n8n-nodes-base.errorTrigger - errorTrigger
Config choices
Version 1

Block 3 - Normalize Error Event

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 4 - Insert ErrorLog

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1.1

Block 5 - Execute Workflow Trigger - Audit API

Type / Role
n8n-nodes-base.executeWorkflowTrigger - executeWorkflowTrigger
Config choices
Version 1

Block 6 - Normalize Audit Event

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 7 - Insert AuditLog

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1.1

Block 8 - Schedule Trigger - Daily Purge

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 9 - Build Purge Config

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 10 - Delete old ErrorLog rows

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1.1

Block 11 - Delete old AuditLog rows

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1.1

Block 12 - Build Purge Audit Event

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 13 - Insert Purge AuditLog

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1.1

Block 14 - ⚙️ Caller Payload Example

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 15 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 16 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 17 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Log errors and audit events with n8n Data Tables
Complexity advanced
Nodes 17
Categories Document Extraction
Author Venkata V
Published 28 Apr 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/15347/15347.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Log errors and audit events with n8n Data Tables do?

How it works This workflow provides a reusable error handling, audit logging, and observability pattern for n8n workflows using two n8n custom Data Tables: and . It is designed to be used across mu...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction use case.