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

263 lines
4.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# LogService
> 审计日志服务
---
## cleanLogsPermanently
> 清理
- 角色:`admin`
- HTTP`POST https://backend.dooki.cloud/LogService/cleanLogsPermanently`
- RPC`rpc cleanLogsPermanently (CleanLogsPermanentlyRequest) returns (RPCSuccess);`
**请求对象 (`CleanLogsPermanentlyRequest`)**
```json
{
"days": "int32",
"clearAll": "bool"
}
```
**响应对象 (`RPCSuccess`)**
```json
{}
```
**调用示例**
```bash
curl -X POST "https://backend.dooki.cloud/LogService/cleanLogsPermanently" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
```
---
## countLogs
> 计算日志数量
- 角色:`admin`
- HTTP`POST https://backend.dooki.cloud/LogService/countLogs`
- RPC`rpc countLogs (CountLogRequest) returns (RPCCountResponse);`
**请求对象 (`CountLogRequest`)**
```json
{
"dayFrom": "string // 可选项,开始日期",
"dayTo": "string // 可选项,结束日期",
"keyword": "string // 可选项,关键词",
"userType": "string // 可选项用户类型admin|user用户端固定为user",
"level": "string // 可选项错误级别info, warn, error"
}
```
**响应对象 (`RPCCountResponse`)**
```json
{
"count": "int64 // 数量"
}
```
**调用示例**
```bash
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`
- HTTP`POST https://backend.dooki.cloud/LogService/createLog`
- RPC`rpc createLog (CreateLogRequest) returns (CreateLogResponse);`
**请求对象 (`CreateLogRequest`)**
```json
{
"level": "string // 级别info, warn, error",
"description": "string // 描述",
"action": "string // 可选项发生操作所在的页面URL",
"ip": "string // 可选项操作用户IP",
"langMessageCode": "string // 多语言消息",
"langMessageArgsJSON": "bytes // 多语言消息中的参数项,格式:[arg1, arg2, ...]"
}
```
**响应对象 (`CreateLogResponse`)**
```json
{}
```
**调用示例**
```bash
curl -X POST "https://backend.dooki.cloud/LogService/createLog" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
```
---
## deleteLogPermanently
> 删除单条
- 角色:`admin`
- HTTP`POST https://backend.dooki.cloud/LogService/deleteLogPermanently`
- RPC`rpc deleteLogPermanently (DeleteLogPermanentlyRequest) returns (RPCSuccess);`
**请求对象 (`DeleteLogPermanentlyRequest`)**
```json
{
"logId": "int64"
}
```
**响应对象 (`RPCSuccess`)**
```json
{}
```
**调用示例**
```bash
curl -X POST "https://backend.dooki.cloud/LogService/deleteLogPermanently" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
```
---
## deleteLogsPermanently
> 批量删除
- 角色:`admin`
- HTTP`POST https://backend.dooki.cloud/LogService/deleteLogsPermanently`
- RPC`rpc deleteLogsPermanently (DeleteLogsPermanentlyRequest) returns (RPCSuccess);`
**请求对象 (`DeleteLogsPermanentlyRequest`)**
```json
{
"logIds": "[]int64"
}
```
**响应对象 (`RPCSuccess`)**
```json
{}
```
**调用示例**
```bash
curl -X POST "https://backend.dooki.cloud/LogService/deleteLogsPermanently" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
```
---
## listLogs
> 列出单页日志
- 角色:`admin`
- HTTP`POST https://backend.dooki.cloud/LogService/listLogs`
- RPC`rpc listLogs (ListLogsRequest) returns (ListLogsResponse);`
**请求对象 (`ListLogsRequest`)**
```json
{
"offset": "int64 // 读取位置从0开始",
"size": "int64 // 读取数量",
"dayFrom": "string // 可选项,开始日期",
"dayTo": "string // 可选项,结束日期",
"keyword": "string // 可选项,关键词",
"userType": "string // 可选项用户类型admin|user用户端固定为user",
"level": "string // 可选项错误级别info, warn, error"
}
```
**响应对象 (`ListLogsResponse`)**
```json
{
"logs": "[]Log"
}
```
**调用示例**
```bash
curl -X POST "https://backend.dooki.cloud/LogService/listLogs" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
```
---
## sumLogsSize
> 计算日志容量大小
- 角色:`admin`
- HTTP`POST https://backend.dooki.cloud/LogService/sumLogsSize`
- RPC`rpc sumLogsSize (SumLogsSizeRequest) returns (SumLogsResponse);`
**请求对象 (`SumLogsSizeRequest`)**
```json
{}
```
**响应对象 (`SumLogsResponse`)**
```json
{
"sizeBytes": "int64"
}
```
**调用示例**
```bash
curl -X POST "https://backend.dooki.cloud/LogService/sumLogsSize" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
```
---