テンプレート - ロガー部分ワーキングフロー

中級

これはDevOps分野の自動化ワークフローで、11個のノードを含みます。主にCode, Supabase, ErrorTrigger, ExecuteWorkflow, ExecuteWorkflowTriggerなどのノードを使用。 SupabaseとLog4j2風レベルを使って構造化されたログシステムを作成する

前提条件
  • Supabase URL と API Key

カテゴリー

ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "id": "0twZGM6kPlG2rFsv",
  "meta": {
    "instanceId": "313b93d489cbc0ae87ad93f25c395bbdc59c46c632d00f395c3586a8fbbb7a34",
    "templateCredsSetupCompleted": true
  },
  "name": "TEMPL - Logger Sub-Workflow",
  "tags": [],
  "nodes": [
    {
      "id": "d8485aa8-429a-4eca-804b-2e2b5ed1a61e",
      "name": "付箋",
      "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": "付箋1",
      "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": "付箋2",
      "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": "エラートリガー",
      "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": "付箋3",
      "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
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

中級 - DevOps

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
中級
ノード数11
カテゴリー1
ノードタイプ6
難易度説明

経験者向け、6-15ノードの中程度の複雑さのワークフロー

作成者
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.

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34