# 实时日志

`GET /cdn/data/{domain}/logs`

查询 CDN 域名的实时访问日志，仅支持查询 **3 天内** 的日志。

返回 **早于** `start_time` 的日志，按时间从新到旧排列，单次最多 1000 条。首次请求把 `start_time` 设为当前时间；需要更多时，把返回结果中最后一条的 `access_time` 作为下一次请求的 `start_time` 继续翻页，直到返回空数组。

Base URL: https://api.bitiful.com

Authentication: API key in header `Authorization`

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `domain` | string | yes | CDN 加速域名。 |

## Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `start_time` | integer | yes | 时间上界，Unix 时间戳，单位**纳秒**，返回早于它的日志；同时用作分页游标。必须在最近 3 天以内。 |
| `codes` | string | no | 按 HTTP 状态码过滤，可选 `ALL`、`2XX`、`3XX`、`4XX`、`5XX`（大写），多个用英文逗号分隔，如 `4XX,5XX`。 |
| `limit` | integer | no | 单次返回的条数。 |

## Example request

```bash
curl -X GET https://api.bitiful.com/cdn/data/cdn.example.com/logs
```

## Responses

- **200**: 日志列表，按访问时间从新到旧排列。没有更多日志时 `data` 为空数组。
- **401**: API Token 缺失或无效。
- **403**: 参数不合法、域名不属于当前账户、额度不足或账户欠费等，原因见 `message`。
- **500**: 服务端错误，请稍后重试。

### Example response (200)

```json
{
  "data": [
    {
      "method": "GET",
      "code": 200,
      "access_time": 1735660800123456000,
      "remote_ip": "203.0.113.8",
      "size": 52480,
      "path": "https://cdn.example.com/images/a.jpg?w=800",
      "ua": "Mozilla/5.0",
      "referer": "https://www.example.com/"
    }
  ]
}
```
