feat: add admin log management routes

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
zyycn
2026-06-13 11:00:48 +08:00
co-authored by Codex
parent 23044393e4
commit f3b37211a4
9 changed files with 395 additions and 37 deletions
+41
View File
@@ -271,6 +271,47 @@ Example item:
}
```
### `GET /admin/logs/state`
Returns the current retained logging configuration plus the number of stored SQLite event logs.
Success response:
```json
{
"code": 200,
"message": "OK",
"data": {
"enabled": false,
"capacity": 2000,
"captureBody": false,
"storedCount": 42
},
"requestId": "req_01"
}
```
### `GET /admin/logs/{id}`
Returns a single stored event log by id using the same event shape as list items. Missing ids return HTTP `404` with body code `40401`.
### `DELETE /admin/logs`
Clears stored SQLite event logs.
Success response:
```json
{
"code": 200,
"message": "OK",
"data": {
"cleared": 42
},
"requestId": "req_01"
}
```
### `GET /admin/usage-stats`
Returns cursor-paginated account usage counters recorded after `/v1/*` calls. The endpoint never returns account access tokens, refresh tokens, Cookie values, or client API keys.