模板 - 记录器子工作流
中级
这是一个DevOps领域的自动化工作流,包含 11 个节点。主要使用 Code, Supabase, ErrorTrigger, ExecuteWorkflow, ExecuteWorkflowTrigger 等节点。 使用Supabase和Log4j2风格级别创建结构化日志系统
前置要求
- •Supabase URL 和 API Key
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "0twZGM6kPlG2rFsv",
"meta": {
"instanceId": "313b93d489cbc0ae87ad93f25c395bbdc59c46c632d00f395c3586a8fbbb7a34",
"templateCredsSetupCompleted": true
},
"name": "模板 - 记录器子工作流",
"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": "## 使用 Supabase 的集中式日志记录(Log4j2 风格)"
},
"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": "## 子工作流"
},
"typeVersion": 1
},
{
"id": "a7fc9373-b69d-4b44-a1ec-6ab987f442b1",
"name": "当记录追踪时",
"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": "创建日志",
"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": "## 使用示例:来自错误处理器的 FATAL 日志"
},
"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": "记录致命错误",
"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": "## 使用示例:记录 DEBUG 或 INFO 消息"
},
"typeVersion": 1
},
{
"id": "f2beed08-2ade-4250-bdab-370939d8397e",
"name": "调用记录器子工作流 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": "记录信息",
"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": "调用记录器子工作流 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": {
"Log Info": {
"main": [
[
{
"node": "Call Logger SubWorkflow 2",
"type": "main",
"index": 0
}
]
]
},
"Log Fatal": {
"main": [
[
{
"node": "Call Logger SubWorkflow 1",
"type": "main",
"index": 0
}
]
]
},
"Error Trigger": {
"main": [
[
{
"node": "Log Fatal",
"type": "main",
"index": 0
}
]
]
},
"When Log Traced": {
"main": [
[
{
"node": "Create Log",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 开发运维
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
错误通知器-v1-无数据库
通过Telegram、Slack和其他通讯工具进行集中错误监控和提醒
Code
Gmail
Slack
+7
13 节点Andrew
开发运维
自动化n8n工作流备份至GitHub并追踪删除
自动化n8n工作流备份至GitHub并追踪删除
If
N8n
Set
+13
31 节点Marcial Ambriz
开发运维
Typebot 流程与 GitHub 双向同步,使用 Typebot API
Typebot 流程与 GitHub 双向同步,使用 Typebot API
If
Set
Code
+12
31 节点Marcial Ambriz
开发运维
Telegram-n8n-指挥官
通过 Telegram 机器人命令远程控制 n8n 实例
If
N8n
Set
+11
67 节点Arthur Braghetto
开发运维
GitHub 同步仪表板 - V2
具有提交历史和回滚功能的 GitHub 工作流版本控制仪表板
If
N8n
Set
+20
94 节点Eduard
开发运维
工作流统计
🦅 通过工作流仪表板全面概览您的n8n实例!
N8n
Set
Xml
+12
31 节点Eduard
开发运维
工作流信息
难度等级
中级
节点数量11
分类1
节点类型6
作者
Elodie Tasia
@ladypixlWeb 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 查看 →
分享此工作流