Files
easygoadmin-wiki/EasyGoAdmin_Gin_NaiveVue/zh/modules/logger.md
T
2026-10-25 17:24:27 +08:00

50 lines
1.7 KiB
Markdown
Raw 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.
# 6.20 日志管理
:::tip 概述
日志管理涵盖两类审计表:**操作日志**(gin_operation_log,接口调用审计)与**登录日志**(gin_login_log,登录行为审计)。均由系统自动写入,管理页只读检索 + 清理。
:::
## 功能清单
两类日志路径前缀与模块名不同(注意拼写):
### 操作日志(/api/oper/log/*,权限码 sys:operLog:*)
| 接口 | 说明 |
|---|---|
| Page / List / Detail | 检索(操作人/类型/时间/IP) |
| Delete / BatchDelete | 手动清理(软删除) |
### 登录日志(/api/login/log/*,权限码 sys:loginLog:*)
| 接口 | 说明 |
|---|---|
| Page / List / Detail | 检索(用户/结果/时间/地域) |
| Delete / BatchDelete | 手动清理 |
## 记录来源
- 操作日志:OperationLog 中间件按 RouteSpec 声明异步落库([5.14 操作日志](/zh/core/operation-log.html))
- 登录日志:auth 模块在登录链路内写入([5.15 登录日志](/zh/core/login-log.html))
## 保留策略
自动保留:`job.logRetentionDays`(默认 90 天),LogClean 定时任务超期**物理清理**(经 WithPhysicalDelete 放行)。管理页的手动删除是软删除,两者不冲突。
## 检索建议
| 场景 | 检索方式 |
|---|---|
| 追查单次操作 | 响应头 X-Request-Id → 日志文件精确定位(表内按人/时间缩小范围) |
| 安全审计 | 登录日志按 status=1 聚合看失败来源 |
| 合规导出 | 操作日志按时间范围导出 |
## 管理界面
`system/logger`:操作日志与登录日志两个页签。
## 相关
- [5.14 操作日志](/zh/core/operation-log.html)
- [5.15 登录日志](/zh/core/login-log.html)