工作室日志
使用 日志 检查你托管项目服务中的事件。对于通过 浏览器、MCP 或 API 的 SQL 查询,请参阅 用 SQL 查询日志。
🌐 Use Logs to inspect events across your hosted project's services. For SQL queries through Explorer, MCP, or the API, see Query logs with SQL.
查找事件 #
🌐 Find events [#product-logs]
- 打开日志。
- 在侧边栏设置时间范围,或者在时间线上选择一个范围。
- 选择一个或多个 日志类型 值。
- 在筛选栏中添加筛选器,或输入文字来搜索事件消息。
- 选择一行以检查事件。
如果没有选择日志类型,日志会查询 Postgres 和 API Gateway。选择类型会替换这个默认设置。时间线会按成功、警告和错误对事件进行分组。
🌐 Without a log type selection, Logs queries Postgres and API Gateway. Selecting types replaces this default set. The timeline groups events by success, warning, and error.
筛选事件 #
🌐 Filter events
| 过滤器 | 行为 |
|---|---|
| 日志类型 | 选择 API Gateway、Postgres、Auth、Storage、PostgREST、Edge Function、Realtime 或 pooler 事件。 |
| 等级 | 匹配成功、警告或错误。 |
| 状态 | 匹配 HTTP 状态或 Postgres SQLSTATE。 |
| 方法 | 匹配 HTTP 方法。 |
| 路径名 | 匹配请求路径。 |
| 事件消息 | 使用 iLike 或 Not iLike 进行不区分大小写的文本匹配或排除。普通文本可匹配消息中的任何位置;% 指定通配符模式。 |
| 用户 | 匹配 Auth actor ID 或 API Gateway JWT subject 中的用户 ID。其他日志类型无法使用此过滤器。 |
除了 事件消息 和 用户,其他过滤器支持 等于 和 不等于。用户 支持 等于。字段中的包含值匹配任何选定值;排除会移除所有选定值。不同字段的过滤器都必须匹配。
🌐 Filters other than Event message and User support Equals and Not equal. User supports Equals. Included values within a field match any selected value; exclusions remove every selected value. Filters on different fields must all match.
网关和服务日志 #
🌐 Gateway and service logs
API 网关下的嵌套服务切换包含或排除网关请求路径。选择单独的Auth、Storage或PostgREST日志类型可以获取该服务自身的日志。这些是不同的事件。
🌐 The nested service toggles under API Gateway include or exclude gateway request paths. Selecting the separate Auth, Storage, or PostgREST log type retrieves that service's own logs. These are different events.
有关 SQL 源名称,请参见 日志字段参考。
🌐 For SQL source names, see the Log field reference.
Postgres #
Postgres 日志包含数据库活动和错误。当启用连接日志记录时,会显示连接事件。在 Postgres 下清除 连接日志 可以隐藏它们。
🌐 Postgres logs contain database activity and errors. Connection events appear when connection logging is enabled. Clear Connection logs under Postgres to hide them.
要记录其他语句类别,请参阅 配置语句日志。
🌐 To record additional statement classes, see Configure statement logging.
检查一个事件 #
🌐 Inspect an event [#expanding-results]
选择一行以打开其详细面板。概览(如果该日志类型可用)显示服务详情。原始 JSON 显示事件数据。可以将面板停靠在底部或右侧。
🌐 Select a row to open its detail panel. Overview, when available for the log type, shows service details. Raw JSON shows the event data. Dock the panel at the bottom or on the right.
Edge 函数的调用可以包含相关的控制台输出。在 SQL 中,调用事件使用 function_edge_logs,控制台事件使用 function_logs。
🌐 Edge Function invocations can include associated console output. In SQL, invocation events use function_edge_logs and console events use function_logs.
观看、分享和导出 #
🌐 Watch, share, and export
- 选择 实时 来自动获取新事件。再次选择可以暂停。开启实时模式会清除固定的时间范围和排序;选择时间范围或排序会停止实时模式。
- 复制页面网址以分享当前筛选条件。接收者需要有项目访问权限。
- 打开 下载日志,选择 CSV 或 JSON,并选择 100、500 或 1,000 行的结果限制。导出会应用当前的过滤条件。如果没有固定的时间范围,请选择要获取的时间段。
要连续排放,请使用 Log drains。
🌐 For continuous export, use Log drains.
缺少结果 #
🌐 Missing results [#single-service-collections]
先检查时间范围、选择的日志类型和排除项。用户如果只和 Postgres 或其他不支持的类型组合,就不会返回匹配项。结果为空并不意味着用户没有活动。
🌐 Check the time range, selected log types, and exclusions first. User combined with only Postgres or another unsupported type returns no matches. An empty result does not establish that the user had no activity.
事件必须先被记录,才能出现在日志中。请参见配置日志和源限制。
🌐 Events must be recorded before they can appear in Logs. See Configure logging and the source limitations.
数据保留取决于你的定价计划。有关账单详情,请参见管理日志使用情况。
🌐 Retention depends on your pricing plan. See Manage Logs usage for billing details.