WebHooker/docs/zh/guide/logs.md
2026-08-13 22:46:35 +00:00

37 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 日志
## 发送日志(`send_logs`
每次分发尝试都会记录到 D1 `send_logs` 表,并可在控制台(**日志**标签页)查看。字段:
| 字段 | 含义 |
| ------------ | -------------------------------------------------------- |
| `routeId` | 匹配的路由 |
| `groupId` | 路由所属分组 |
| `event` | 事件类型(如 `push``pull_request``custom` |
| `repo` | 仓库全名(存在时) |
| `target` | 消息发送到的目标 id |
| `platform` | `discord``telegram` |
| `ok` | 发送是否成功 |
| `status` | 平台 API 的 HTTP 状态码(适用时) |
| `error` | 失败时的错误信息 |
| `errorCode` | 稳定错误码(如 `NO_TARGET``NO_TOKEN``RATE_LIMITED` |
| `attempts` | 含重试在内的发送次数 |
| `durationMs` | 发送耗时 |
| `deliveryId` | Webhook 投递 id提供时 |
| `messageId` | 平台消息 id用于原地编辑 |
| `actor` | 发送者登录名 |
| `action` | 事件动作(存在时) |
| `detail` | 附加 JSON 详情(存在时) |
控制台的**日志**标签页列出最近记录(可按分组过滤),并可查看单条完整详情。写入为尽力而为——插入失败不会中断分发。
## 审计日志(`audit_logs`
所有管理员操作都会记录到 D1 `audit_logs` 表,并可在控制台(**审计**标签页)查看:登录/登出、分组/路由/成员/邀请变更、Token 撤销、安装绑定等。字段时间戳、操作者GitHub id + 登录名)、动作、目标类型/id、分组 id、IP 与详情 JSON。
记录由定时任务在 `AUDIT_RETENTION_DAYS`(默认 90后自动清理。与发送日志一样写入为尽力而为。
## Webhook 日志频道
分组还可以在 Discord 频道/子区或 Telegram 群组/话题中接收每条 webhook 的摘要消息——见[分组 → Webhook 日志频道](./groups#webhook-日志频道)。这些摘要是尽力发送的,**不会**记录到 `send_logs`