Modèle - Sous-flux d'enregistreur

Intermédiaire

Ceci est unDevOpsworkflow d'automatisation du domainecontenant 11 nœuds.Utilise principalement des nœuds comme Code, Supabase, ErrorTrigger, ExecuteWorkflow, ExecuteWorkflowTrigger. Utiliser Supabase et les niveaux de style Log4j2 pour créer un système de journalisation structuré

Prérequis
  • URL et Clé API Supabase

Catégorie

Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "id": "0twZGM6kPlG2rFsv",
  "meta": {
    "instanceId": "313b93d489cbc0ae87ad93f25c395bbdc59c46c632d00f395c3586a8fbbb7a34",
    "templateCredsSetupCompleted": true
  },
  "name": "TEMPL - Logger Sub-Workflow",
  "tags": [],
  "nodes": [
    {
      "id": "d8485aa8-429a-4eca-804b-2e2b5ed1a61e",
      "name": "Note adhésive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        -48
      ],
      "parameters": {
        "color": 4,
        "width": 816,
        "height": 1248,
        "content": "## Centralized Logging with Supabase (Log4j2-style)\n\n\nThis workflow provides a simple yet powerful logging solution for n8n, inspired by Log4j2's log levels. \n\nIt enables you to send structured log entries (DEBUG, INFO, WARN, ERROR, FATAL) directly to a Supabase PostgreSQL database. Whether you're tracking workflow executions, node-level issues, or custom debugging events, this template offers a clean and scalable way to store and query logs from across your automation stack — perfect for monitoring, debugging, or building analytics dashboards.\n\n\nYou need first to setup Supabase database and credentials:\n\n\n### 1. Supabase Configuration\n\n- Create an enumerated type (in Database -> Database Management -> Enumerated Types):\n\t- Name: **log_level_type**\n\t- Values: TRACE, DEBUG, INFO, WARN, ERROR, FATAL\n\n\n- Create a table **logs** with following fields  (in Database -> Database Management -> Tables):\n\t- id #int8 (leave by default)\n\t- created_at timestamp (leave by default)\n\t- workflow_name text (deactivate the \"Is Nullable\" option)\n\t- node_name text (deactivate the \"Is Nullable\" option)\n\t- execution_id text (deactivate the \"Is Nullable\" option)\n\t- log_level log_level_type (deactivate the \"Is Nullable\" option)\n\t- message text (deactivate the \"Is Nullable\" option)\n  \t- metadata json\n\n\n- If you prefer the SQL scripts:\n\n```\n-- Enum type for log_level\ncreate type log_level_type as enum ('TRACE','DEBUG','INFO','WARN','ERROR','FATAL');\n  \n-- logs table\ncreate table publi c.logs (\n  id bigserial primary key,\n  created_at timestamp with time zone default now() not null,\n  workflow_name text not null,\n  node_name text not null,\n  execution_id text not null,\n  log_level log_level_type not null,\n  message text not null,\n  metadata jsonb\n);\n```\n\n\n\n### 2. Create Credentials to your Supabase Account in N8N\n\nhttps://docs.n8n.io/integrations/builtin/credentials/supabase/\n\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "80068177-98b8-46bf-bfb6-74613e8ce905",
      "name": "Note adhésive1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        -48
      ],
      "parameters": {
        "color": 6,
        "width": 672,
        "height": 400,
        "content": "## SUB-WORKFLOW\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a7fc9373-b69d-4b44-a1ec-6ab987f442b1",
      "name": "When Log Traced",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        192,
        96
      ],
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "workflow_name"
            },
            {
              "name": "node_name"
            },
            {
              "name": "execution_id"
            },
            {
              "name": "log_level"
            },
            {
              "name": "message"
            },
            {
              "name": "metadata",
              "type": "object"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "efde8a30-d04e-4c3d-a9e7-a689cad53e8b",
      "name": "Create Log",
      "type": "n8n-nodes-base.supabase",
      "position": [
        416,
        96
      ],
      "parameters": {
        "tableId": "logs",
        "dataToSend": "autoMapInputData"
      },
      "credentials": {
        "supabaseApi": {
          "id": "4kNhR3z2qk4eUvOY",
          "name": "Supabase account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9ffc0d43-de4f-498f-918b-7075ef9404a2",
      "name": "Note adhésive2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        800
      ],
      "parameters": {
        "color": 7,
        "width": 672,
        "height": 400,
        "content": "## Usage Example : FATAL log from an error handler\n\nThis is a generic error handler workflow that you can configure in a workflow settings."
      },
      "typeVersion": 1
    },
    {
      "id": "aed41c4a-37d9-4d69-99f6-8f1ac4b9604d",
      "name": "Déclencheur d'erreur",
      "type": "n8n-nodes-base.errorTrigger",
      "disabled": true,
      "position": [
        96,
        992
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "8708f89c-3c24-4a79-9228-9d30dcfcb470",
      "name": "Log Fatal",
      "type": "n8n-nodes-base.code",
      "disabled": true,
      "position": [
        304,
        992
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const e = $json; // Error Trigger\nreturn {\n        \"workflow_name\": e.workflow?.name ?? $workflow.name,\n        \"node_name\": e.execution?.lastNodeExecuted ?? $prevNode.name,\n        \"execution_id\": e.execution?.id ?? $execution.id,\n        \"log_level\": \"FATAL\",\n        \"message\": e.execution?.error?.message ?? 'Unknown error',  \n        \"metadata\": e\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "c04e954e-f560-4240-b6f2-940e9922b5ab",
      "name": "Note adhésive3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        384
      ],
      "parameters": {
        "color": 7,
        "width": 672,
        "height": 400,
        "content": "## Usage Example : log a DEBUG or INFO message\n\nCustomize the log_level, message and optional metadata.\nUse inside a workflow to trace info and debug messages."
      },
      "typeVersion": 1
    },
    {
      "id": "f2beed08-2ade-4250-bdab-370939d8397e",
      "name": "Call Logger SubWorkflow 1",
      "type": "n8n-nodes-base.executeWorkflow",
      "disabled": true,
      "position": [
        512,
        992
      ],
      "parameters": {
        "options": {
          "waitForSubWorkflow": false
        },
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "0twZGM6kPlG2rFsv",
          "cachedResultName": "TEMPL - Logger Sub-Workflow"
        },
        "workflowInputs": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "13f0d706-7f4e-4d97-bc90-2ab8ebce390e",
      "name": "Log Info",
      "type": "n8n-nodes-base.code",
      "disabled": true,
      "position": [
        208,
        560
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": " return {\n        \"workflow_name\": $workflow.name,\n        \"node_name\": $prevNode.name || \"Unknown node\",\n        \"execution_id\": $execution.id,\n        \"log_level\": \"INFO\",\n        \"message\": \"Insert your message here\",        \n        \"metadata\": {\n           \"attr1\": \"value1\",\n           \"attr2\": 123\n        }\n }"
      },
      "typeVersion": 2
    },
    {
      "id": "2bb9b8a3-876f-4246-8f41-81163dae799a",
      "name": "Call Logger SubWorkflow 2",
      "type": "n8n-nodes-base.executeWorkflow",
      "disabled": true,
      "position": [
        400,
        560
      ],
      "parameters": {
        "options": {
          "waitForSubWorkflow": false
        },
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "0twZGM6kPlG2rFsv",
          "cachedResultName": "TEMPL - Logger Sub-Workflow"
        },
        "workflowInputs": {
          "value": {
            "message": "={{ $json.message }}",
            "metadata": "={{ $json.metadata }}",
            "log_level": "={{ $json.log_level }}",
            "node_name": "={{ $json.node_name }}",
            "execution_id": "={{ $json.execution_id }}",
            "workflow_name": "={{ $json.workflow_name }}"
          },
          "schema": [
            {
              "id": "workflow_name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "workflow_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "node_name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "node_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "execution_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "execution_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "log_level",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "log_level",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "message",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "metadata",
              "type": "object",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "metadata",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        }
      },
      "typeVersion": 1.2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "00769a5f-87e6-423a-a420-36ca80479403",
  "connections": {
    "13f0d706-7f4e-4d97-bc90-2ab8ebce390e": {
      "main": [
        [
          {
            "node": "2bb9b8a3-876f-4246-8f41-81163dae799a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8708f89c-3c24-4a79-9228-9d30dcfcb470": {
      "main": [
        [
          {
            "node": "f2beed08-2ade-4250-bdab-370939d8397e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Error Trigger": {
      "main": [
        [
          {
            "node": "8708f89c-3c24-4a79-9228-9d30dcfcb470",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a7fc9373-b69d-4b44-a1ec-6ab987f442b1": {
      "main": [
        [
          {
            "node": "efde8a30-d04e-4c3d-a9e7-a689cad53e8b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Intermédiaire - DevOps

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Intermédiaire
Nombre de nœuds11
Catégorie1
Types de nœuds6
Description de la difficulté

Adapté aux utilisateurs expérimentés, avec des workflows de complexité moyenne contenant 6-15 nœuds

Auteur
Elodie Tasia

Elodie Tasia

@ladypixl

Web designer & AI automation creator. I build clean, conversion-ready sites and n8n workflows that take your content from idea to publish, on autopilot, in your voice. Grab my templates or message me for a custom build.

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34