Skip to content

Commit 0548134

Browse files
authored
refine the system history tables (#2349)
* refine the system history tables * Update index.md
1 parent e441021 commit 0548134

File tree

7 files changed

+55
-18
lines changed

7 files changed

+55
-18
lines changed

docs/en/sql-reference/00-sql-reference/31-system-history-tables/index.md

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: System History Tables
3+
---
4+
5+
# System History Tables
6+
7+
System history tables store persistent data in the `system_history` schema for auditing, troubleshooting, and compliance purposes. They track query execution, user logins, and system logs that can be queried using standard SQL.
8+
9+
## Available System History Tables
10+
11+
| Table | Description |
12+
|-----------------------------------------------------|-----------------------------------------------------------------|
13+
| [system_history.log_history](log-history.md) | Stores raw log entries from various system components. |
14+
| [system_history.query_history](query-history.md) | Stores structured details of query execution. |
15+
| [system_history.profile_history](profile-history.md)| Stores detailed query execution profiles and statistics. |
16+
| [system_history.login_history](login-history.md) | Records information about user login events. |
17+
18+
## Enabling System History Tables
19+
20+
> **Note:** In **Databend Cloud**, system history tables are automatically enabled and ready to use without any configuration needed. The following section applies only to **self-hosted Databend**.
21+
22+
In self-hosted Databend, system history tables are disabled by default. To enable them, configure the `[log.history]` section in your `databend-query.toml` file.
23+
24+
<details>
25+
<summary>Configuration Example</summary>
26+
27+
```toml
28+
[log.history]
29+
# Enable history tables
30+
on = true
31+
level = "INFO"
32+
33+
# Configure retention policies for each table
34+
[[log.history.tables]]
35+
table_name = "log_history"
36+
retention = 168 # 7 days (in hours)
37+
38+
[[log.history.tables]]
39+
table_name = "query_history"
40+
retention = 168
41+
42+
[[log.history.tables]]
43+
table_name = "profile_history"
44+
retention = 168
45+
46+
[[log.history.tables]]
47+
table_name = "login_history"
48+
retention = 168
49+
```
50+
51+
> **Note:** The `log_history` table is enabled by default when history logging is turned on.
52+
53+
</details>
54+
55+
For more details about configuration options, see [Query Configuration: [log.history] Section](/guides/deploy/references/node-config/query-config#loghistory-section).

0 commit comments

Comments
 (0)