Files
2025-11-18 03:36:49 +08:00

4.8 KiB
Raw Permalink Blame History

LogService

审计日志服务


cleanLogsPermanently

清理

  • 角色:admin
  • HTTPPOST https://backend.dooki.cloud/LogService/cleanLogsPermanently
  • RPCrpc cleanLogsPermanently (CleanLogsPermanentlyRequest) returns (RPCSuccess);

请求对象 (CleanLogsPermanentlyRequest)

{
  "days": "int32",
  "clearAll": "bool"
}

响应对象 (RPCSuccess)

{}

调用示例

curl -X POST "https://backend.dooki.cloud/LogService/cleanLogsPermanently" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'

countLogs

计算日志数量

  • 角色:admin
  • HTTPPOST https://backend.dooki.cloud/LogService/countLogs
  • RPCrpc countLogs (CountLogRequest) returns (RPCCountResponse);

请求对象 (CountLogRequest)

{
  "dayFrom": "string // 可选项,开始日期",
  "dayTo": "string // 可选项,结束日期",
  "keyword": "string // 可选项,关键词",
  "userType": "string // 可选项用户类型admin|user用户端固定为user",
  "level": "string // 可选项错误级别info, warn, error"
}

响应对象 (RPCCountResponse)

{
  "count": "int64 // 数量"
}

调用示例

curl -X POST "https://backend.dooki.cloud/LogService/countLogs" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'

createLog

创建日志

  • 角色:user, admin
  • HTTPPOST https://backend.dooki.cloud/LogService/createLog
  • RPCrpc createLog (CreateLogRequest) returns (CreateLogResponse);

请求对象 (CreateLogRequest)

{
  "level": "string // 级别info, warn, error",
  "description": "string // 描述",
  "action": "string // 可选项发生操作所在的页面URL",
  "ip": "string // 可选项操作用户IP",
  "langMessageCode": "string // 多语言消息",
  "langMessageArgsJSON": "bytes // 多语言消息中的参数项,格式:[arg1, arg2, ...]"
}

响应对象 (CreateLogResponse)

{}

调用示例

curl -X POST "https://backend.dooki.cloud/LogService/createLog" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'

deleteLogPermanently

删除单条

  • 角色:admin
  • HTTPPOST https://backend.dooki.cloud/LogService/deleteLogPermanently
  • RPCrpc deleteLogPermanently (DeleteLogPermanentlyRequest) returns (RPCSuccess);

请求对象 (DeleteLogPermanentlyRequest)

{
  "logId": "int64"
}

响应对象 (RPCSuccess)

{}

调用示例

curl -X POST "https://backend.dooki.cloud/LogService/deleteLogPermanently" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'

deleteLogsPermanently

批量删除

  • 角色:admin
  • HTTPPOST https://backend.dooki.cloud/LogService/deleteLogsPermanently
  • RPCrpc deleteLogsPermanently (DeleteLogsPermanentlyRequest) returns (RPCSuccess);

请求对象 (DeleteLogsPermanentlyRequest)

{
  "logIds": "[]int64"
}

响应对象 (RPCSuccess)

{}

调用示例

curl -X POST "https://backend.dooki.cloud/LogService/deleteLogsPermanently" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'

listLogs

列出单页日志

  • 角色:admin
  • HTTPPOST https://backend.dooki.cloud/LogService/listLogs
  • RPCrpc listLogs (ListLogsRequest) returns (ListLogsResponse);

请求对象 (ListLogsRequest)

{
  "offset": "int64 // 读取位置从0开始",
  "size": "int64 // 读取数量",
  "dayFrom": "string // 可选项,开始日期",
  "dayTo": "string // 可选项,结束日期",
  "keyword": "string // 可选项,关键词",
  "userType": "string // 可选项用户类型admin|user用户端固定为user",
  "level": "string // 可选项错误级别info, warn, error"
}

响应对象 (ListLogsResponse)

{
  "logs": "[]Log"
}

调用示例

curl -X POST "https://backend.dooki.cloud/LogService/listLogs" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'

sumLogsSize

计算日志容量大小

  • 角色:admin
  • HTTPPOST https://backend.dooki.cloud/LogService/sumLogsSize
  • RPCrpc sumLogsSize (SumLogsSizeRequest) returns (SumLogsResponse);

请求对象 (SumLogsSizeRequest)

{}

响应对象 (SumLogsResponse)

{
  "sizeBytes": "int64"
}

调用示例

curl -X POST "https://backend.dooki.cloud/LogService/sumLogsSize" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'