Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .translation-init
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
Translation initialization: 2025-10-15T11:24:33.265486

Translation initialization: 2025-10-17T11:13:57.833983
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,32 @@ import DetailsWrap from '@site/src/components/DetailsWrap';

# 系统历史表

Databend 的系统历史表通过自动追踪数据库活动,为合规审计、安全监控和性能分析提供**数据治理 (Data Governance)** 能力
Databend 的系统历史表通过自动跟踪数据库活动,提供**数据治理Data Governance)**能力,以满足合规性、安全监控和性能分析的需求

## 可用表

| 表 | 用途 | 主要用例 |
| ------------------------------------- | ---------------------------------- | ---------------------------------------------------------------------- |
| [query_history](query-history.md) | 完整的 SQL 执行审计追踪 | 性能分析、合规追踪、使用监控 |
| [access_history](access-history.md) | 数据访问与修改日志 | 数据血缘、合规报告、变更管理 |
| [login_history](login-history.md) | 用户认证追踪 | 安全审计、失败登录监控、访问模式分析 |
| [profile_history](profile-history.md) | 详细查询执行画像 | 性能优化、资源规划、瓶颈识别 |
| [log_history](log-history.md) | 原始系统日志与事件 | 系统故障排查、错误分析、运维监控 |
| [query_history](query-history.md) | 完整的 SQL 执行审计跟踪 | 性能分析、合规性跟踪、使用情况监控 |
| [access_history](access-history.md) | 数据访问和修改日志 | 数据血缘、合规性报告、变更管理 |
| [login_history](login-history.md) | 用户身份验证跟踪 | 安全审计、失败登录监控、访问模式分析 |
| [profile_history](profile-history.md) | 详细的查询执行配置文件 | 性能优化、资源规划、瓶颈识别 |
| [log_history](log-history.md) | 原始系统日志和事件 | 系统故障排查、错误分析、运营监控 |

## 权限

**访问限制:**

- 仅允许 `SELECT` 和 `DROP` 操作
- 禁止所有用户执行 `ALTER` 操作
- 所有权不可转移
- 只允许 `SELECT` 和 `DROP` 操作
- 禁止所有用户执行 `ALTER` 操作
- 所有权不可转移

**所需权限:**
查询系统历史表需具备以下任一权限
要查询系统历史表,用户需要以下权限之一

- `GRANT SELECT ON *.*`(全局访问)
- `GRANT SELECT ON system_history.*`(数据库级访问)
- `GRANT SELECT ON system_history.table_name`(表级访问)
- `GRANT SELECT ON *.*`(全局访问)
- `GRANT SELECT ON system_history.*`(数据库访问)
- `GRANT SELECT ON system_history.table_name`(表级访问)

**示例:**

Expand All @@ -50,24 +50,24 @@ GRANT ROLE audit_team TO USER compliance_officer;

### Databend Cloud

✅ **自动启用** — 所有系统历史表开箱即用,无需额外配置
✅ **自动启用** - 所有系统历史表已就绪,无需任何配置

### 自建 Databend
### 自托管 Databend

<DetailsWrap>
<details>
<summary>📝 **需手动配置** 点击展开配置详情</summary>
<details open>
<summary>📝 **需手动配置** - 点击展开配置详情</summary>

#### 最小配置

启用系统历史表须在 `databend-query.toml` 中配置全部 5 张表:
要启用系统历史表,必须在 `databend-query.toml` 中配置全部 5 张表:

```toml
[log.history]
on = true

# 必须配置全部 5 张表才能启用历史日志
# retention 为可选项(默认 168 小时 = 7 天)
# 必须配置全部 5 张表才能启用历史记录
# retention 为可选项(默认168 小时 = 7 天)
[[log.history.tables]]
table_name = "query_history"
retention = 168 # 可选:7 天(默认)
Expand All @@ -91,7 +91,7 @@ retention = 168 # 可选:7 天(默认)

#### 自定义存储(可选)

默认情况下,历史表使用主数据库存储。如需独立 S3 存储:
默认情况下,历史表使用主数据库存储。如需使用独立的 S3 存储:

```toml
[log.history]
Expand Down Expand Up @@ -122,9 +122,9 @@ table_name = "login_history"
table_name = "access_history"
```

> ⚠️ **注意:** 修改存储配置后,现有历史表将被删除并重新创建。
> ⚠️ **注意:** 更改存储配置时,现有历史表将被删除并重新创建。

</details>
</DetailsWrap>

完整配置选项请参考 [查询配置:[log.history] 部分](/guides/deploy/references/node-config/query-config#loghistory-section)。
有关完整配置选项,请参阅 [查询配置:[log.history] 部分](/guides/deploy/references/node-config/query-config#loghistory-section)。