NATSaudit.log.export导出审计日志
Try it 面板需要启用 JavaScript。
按过滤条件一次性导出,不分页,上限 10000 条;超限返回 1006 要求收窄时间窗。管理侧 audit-logs/export HTTP 接口的后端。
Request Payload
消息格式:JSON
| Name | Data Type | Required | Description |
|---|---|---|---|
| userId | string | No | 按行为主体过滤 |
| action | string | No | 按动作过滤 |
| resource | string | No | 按资源过滤 |
| result | string | No | success / failure |
| since | string | Yes | 起始时间(ISO 8601 UTC) |
| until | string | Yes | 结束时间(ISO 8601 UTC) |
type RequestBody = {
/** 按行为主体过滤 */
userId?: string
/** 按动作过滤 */
action?: string
/** 按资源过滤 */
resource?: string
/** success / failure */
result?: string
/** 起始时间(ISO 8601 UTC) */
since: string
/** 结束时间(ISO 8601 UTC) */
until: string
}{
"action": "auth.login.password",
"since": "2026-10-01T00:00:00Z",
"until": "2026-10-14T00:00:00Z"
}Response Payload
回复使用统一信封 {id, code, messages, result},其 result:
| Name | Data Type | Required | Description |
|---|---|---|---|
| items | array | Yes | 导出的日志全集 |
| total | number | Yes | 导出条数 |
type ResponseBody = {
/** 导出的日志全集 */
items: Record<string, unknown>[]
/** 导出条数 */
total: number
}{
"items": [
{
"logId": "01JD8SNXER6Y9Z5FZ",
"actorId": "01JD8SEGQ0P9N2XK4L7VDH3T6C",
"action": "auth.login.password",
"resource": "user/01JD8SEGQ0P9N2XK4L7VDH3T6C",
"result": "success",
"ip": "203.0.113.24",
"occurredAt": "2026-10-14T08:00:00Z"
}
],
"total": 1204
}Response Code
回复使用统一信封 {id, code, messages, result},其 code 字段:
| code | Meaning | Notes |
|---|---|---|
| 0 | 成功 | 导出审计日志 |
| 2902 | 结果集过大 | 超过 10000 条上限,收窄时间窗后重试 |
Examples
{ "action": "auth.login.password", "since": "2026-10-01T00:00:00Z", "until": "2026-10-14T00:00:00Z" }
{
"id": "01JD8SXFR6S8UQ",
"code": 0,
"messages": [],
"result": {
"items": [
{
"logId": "01JD8SNXER6Y9Z5FZ",
"actorId": "01JD8SEGQ0P9N2XK4L7VDH3T6C",
"action": "auth.login.password",
"resource": "user/01JD8SEGQ0P9N2XK4L7VDH3T6C",
"result": "success",
"ip": "203.0.113.24",
"occurredAt": "2026-10-14T08:00:00Z"
}
],
"total": 1204
}
}