日志
打开 日志 并选择 存储 作为日志类型来检查存储服务事件。通过时间和事件消息进行筛选以找到请求。
🌐 Open Logs and select Storage as the log type to inspect Storage service events. Filter by time and event message to find a request.
对于更高级的过滤需求,在选择 Run SQL 后使用 Explorer,选择查询源 Logs 和时间范围,可以直接查询存储日志。Logs 查询运行的是 ClickHouse SQL,而不是 Postgres SQL。每一行日志都是 logs 表中的一行,通过 source 列进行标记,结构化字段存储在 log_attributes map 中。
🌐 For more advanced filtering needs, use the Explorer after selecting Run SQL, query source Logs, and a time range to query the Storage logs directly. A Logs query runs ClickHouse SQL rather than Postgres SQL. Every log line is a row in the logs table, tagged by a source column, with structured fields in a log_attributes map.
想了解更多关于筛选日志表的细节,请参阅 使用 SQL 查询日志
🌐 For more details on filtering the log tables, see Query logs with SQL
示例存储查询 #
🌐 Example Storage queries
按状态 5XX 错误筛选 #
🌐 Filter by status 5XX error
select id, timestamp, event_message, toInt32OrZero(log_attributes['res.statusCode']) as statusCode, log_attributes['error.message'] as errorMessage, log_attributes['error.raw'] as rawErrorfrom logswhere source = 'storage_logs' and toInt32OrZero(log_attributes['res.statusCode']) >= 500order by timestamp desclimit 100;按状态筛选 4XX 错误 #
🌐 Filter by status 4XX error
select id, timestamp, event_message, toInt32OrZero(log_attributes['res.statusCode']) as statusCode, log_attributes['error.message'] as errorMessage, log_attributes['error.raw'] as rawErrorfrom logswhere source = 'storage_logs' and toInt32OrZero(log_attributes['res.statusCode']) between 400 and 499order by timestamp desclimit 100;按方法筛选 #
🌐 Filter by method
select id, timestamp, event_message, log_attributes['req.method'] as methodfrom logswhere source = 'storage_logs' and log_attributes['req.method'] in ('POST')order by timestamp desclimit 100;按IP地址过滤 #
🌐 Filter by IP address
select id, timestamp, event_message, log_attributes['req.remoteAddress'] as remoteAddressfrom logswhere source = 'storage_logs' and log_attributes['req.remoteAddress'] in ('IP_ADDRESS')order by timestamp desclimit 100;