Skip to content

Commit 58cdb68

Browse files
authored
add login history from 2091 (#1089)
1 parent d6b38ee commit 58cdb68

8 files changed

Lines changed: 608 additions & 12 deletions

File tree

src/UserGuide/Master/Table/Tools-System/CLI_timecho.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,72 @@ To exit the CLI and terminate the session, type`quit`or`exit`.
107107
1. **Navigate Command History:** Use the up and down arrow keys.
108108
2. **Auto-Complete Commands:** Use the right arrow key.
109109
3. **Interrupt Command Execution:** Press `CTRL+C`.
110+
111+
## 4. Access History Feature
112+
113+
Since IoTDB **V2.0.9.1**, the access history feature is available. After a client logs in successfully, key historical access information is displayed, and the feature supports distributed deployments. Both administrators and regular users can only view their own access history. The core displayed information includes:
114+
115+
- Last successful session: displays date, time, access application, IP address, and access method (not shown for first login or when no history exists).
116+
- Most recent failed attempt: displays the date, time, access application, IP address, and access method of the latest failed login attempt immediately before the current successful login.
117+
- Cumulative failed attempts: total number of failed session attempts since the last successful session was established.
118+
119+
### 4.1 Enabling Access History
120+
121+
You can enable or disable the access history feature by modifying the corresponding parameter in the `iotdb-system.properties` file. A restart is required for changes to take effect. For example:
122+
123+
```Plain
124+
# Controls whether the audit log feature is enabled
125+
enable_audit_log=false
126+
```
127+
128+
- When enabled: login information is recorded and expired data is cleaned periodically.
129+
- When disabled: no data is recorded, displayed, or cleaned up.
130+
- If disabled and then re-enabled, the displayed history will be the last record before the feature was disabled, which may not reflect the actual latest login.
131+
132+
Usage example:
133+
134+
```Bash
135+
---------------------
136+
Starting IoTDB Cli
137+
---------------------
138+
_____ _________ ______ ______
139+
|_ _| | _ _ ||_ _ `.|_ _ \
140+
| | .--.|_/ | | \_| | | `. \ | |_) |
141+
| | / .'`\ \ | | | | | | | __'.
142+
_| |_| \__. | _| |_ _| |_.' /_| |__) |
143+
|_____|'.__.' |_____| |______.'|_______/ Enterprise version 2.0.9.1 (Build: xxxxxxx)
144+
145+
146+
---Last Successful Session------------------
147+
Time: 2026-03-24T10:25:47.759+08:00
148+
IP Address: 127.0.0.1
149+
---Last Failed Session----------------------
150+
Time: 2026-03-24T10:27:26.314+08:00
151+
IP Address: 127.0.0.1
152+
Cumulative Failed Attempts: 1
153+
Successfully logged in at 127.0.0.1:6667
154+
IoTDB>
155+
```
156+
157+
### 4.2 Viewing Access History
158+
159+
The `root` user and users with the `AUDIT` privilege can view login history records using SQL statements.
160+
161+
Syntax:
162+
163+
```SQL
164+
SELECT * FROM __audit.login_history;
165+
```
166+
167+
Example:
168+
169+
```SQL
170+
IoTDB> SELECT * FROM __audit.login_history
171+
+-----------------------------+-------+-------+--------+---------+------+
172+
| time|user_id|node_id|username| ip|result|
173+
+-----------------------------+-------+-------+--------+---------+------+
174+
|2026-03-25T10:55:58.240+08:00| u_0| node_1| root|127.0.0.1| true|
175+
+-----------------------------+-------+-------+--------+---------+------+
176+
Total line number = 1
177+
It costs 0.213s
178+
```

src/UserGuide/Master/Tree/Tools-System/CLI_timecho.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,83 @@ It costs 0.267s
193193
```
194194

195195
It should be noted that the use of the -e parameter in shell scripts requires attention to the escaping of special characters.
196+
197+
## 5. Access History Feature
198+
199+
Since IoTDB **V2.0.9.1**, the access history feature is supported. After a client logs in successfully, key historical access information is displayed, and the feature supports distributed scenarios. Both administrators and regular users can only view their own access history. The core displayed information includes:
200+
201+
- Last successful session: displays date, time, access application, IP address, and access method (not shown for first login or when no history exists).
202+
- Most recent failed attempt: displays the date, time, access application, IP address, and access method of the latest failed login attempt before the current successful login.
203+
- Cumulative failed attempts: total number of failed session attempts since the last successful session was established.
204+
205+
### 5.1 Enabling Access History
206+
207+
You can enable or disable the access history feature by modifying relevant parameters in the `iotdb-system.properties` file. A restart is required for changes to take effect. For example:
208+
209+
```Plain
210+
# Controls whether the audit log feature is enabled
211+
enable_audit_log=false
212+
```
213+
214+
- When enabled: login information is recorded and expired data is cleaned periodically.
215+
- When disabled: no data is recorded, displayed, or cleaned.
216+
- If disabled and then re-enabled, the displayed history will be the last record before disabling, which may not represent the actual latest login.
217+
218+
Usage example:
219+
220+
```Bash
221+
---------------------
222+
Starting IoTDB Cli
223+
---------------------
224+
_____ _________ ______ ______
225+
|_ _| | _ _ ||_ _ `.|_ _ \
226+
| | .--.|_/ | | \_| | | `. \ | |_) |
227+
| | / .'`\ \ | | | | | | | __'.
228+
_| |_| \__. | _| |_ _| |_.' /_| |__) |
229+
|_____|'.__.' |_____| |______.'|_______/ Enterprise version 2.0.9.1 (Build: xxxxxxx)
230+
231+
232+
---Last Successful Session------------------
233+
Time: 2026-03-24T10:25:47.759+08:00
234+
IP Address: 127.0.0.1
235+
---Last Failed Session----------------------
236+
Time: 2026-03-24T10:27:26.314+08:00
237+
IP Address: 127.0.0.1
238+
Cumulative Failed Attempts: 1
239+
Successfully login at 127.0.0.1:6667
240+
IoTDB>
241+
```
242+
243+
### 5.2 Viewing Access History
244+
245+
The `root` user and users with the `AUDIT` privilege can view access history records using SQL statements.
246+
247+
Syntax:
248+
249+
```SQL
250+
SELECT * FROM root.__audit.login.u_{userid}.**
251+
```
252+
253+
The `userid` can be obtained using the `LIST USER` statement.
254+
255+
Example:
256+
257+
```SQL
258+
IoTDB> SELECT * FROM root.__audit.login.**
259+
+-----------------------------+------------------------------------+--------------------------------+--------------------------------------+
260+
| Time|root.__audit.login.u_0.node_1.result|root.__audit.login.u_0.node_1.ip|root.__audit.login.u_0.node_1.username|
261+
+-----------------------------+------------------------------------+--------------------------------+--------------------------------------+
262+
|2026-03-25T10:55:58.240+08:00| true| 127.0.0.1| root|
263+
+-----------------------------+------------------------------------+--------------------------------+--------------------------------------+
264+
Total line number = 1
265+
It costs 0.039s
266+
267+
IoTDB> SELECT * FROM root.__audit.login.u_0.**
268+
+-----------------------------+------------------------------------+--------------------------------+--------------------------------------+
269+
| Time|root.__audit.login.u_0.node_1.result|root.__audit.login.u_0.node_1.ip|root.__audit.login.u_0.node_1.username|
270+
+-----------------------------+------------------------------------+--------------------------------+--------------------------------------+
271+
|2026-03-25T10:55:58.240+08:00| true| 127.0.0.1| root|
272+
+-----------------------------+------------------------------------+--------------------------------+--------------------------------------+
273+
Total line number = 1
274+
It costs 0.020s
275+
```

src/UserGuide/latest-Table/Tools-System/CLI_timecho.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,72 @@ To exit the CLI and terminate the session, type`quit`or`exit`.
107107
1. **Navigate Command History:** Use the up and down arrow keys.
108108
2. **Auto-Complete Commands:** Use the right arrow key.
109109
3. **Interrupt Command Execution:** Press `CTRL+C`.
110+
111+
## 4. Access History Feature
112+
113+
Since IoTDB **V2.0.9.1**, the access history feature is available. After a client logs in successfully, key historical access information is displayed, and the feature supports distributed deployments. Both administrators and regular users can only view their own access history. The core displayed information includes:
114+
115+
- Last successful session: displays date, time, access application, IP address, and access method (not shown for first login or when no history exists).
116+
- Most recent failed attempt: displays the date, time, access application, IP address, and access method of the latest failed login attempt immediately before the current successful login.
117+
- Cumulative failed attempts: total number of failed session attempts since the last successful session was established.
118+
119+
### 4.1 Enabling Access History
120+
121+
You can enable or disable the access history feature by modifying the corresponding parameter in the `iotdb-system.properties` file. A restart is required for changes to take effect. For example:
122+
123+
```Plain
124+
# Controls whether the audit log feature is enabled
125+
enable_audit_log=false
126+
```
127+
128+
- When enabled: login information is recorded and expired data is cleaned periodically.
129+
- When disabled: no data is recorded, displayed, or cleaned up.
130+
- If disabled and then re-enabled, the displayed history will be the last record before the feature was disabled, which may not reflect the actual latest login.
131+
132+
Usage example:
133+
134+
```Bash
135+
---------------------
136+
Starting IoTDB Cli
137+
---------------------
138+
_____ _________ ______ ______
139+
|_ _| | _ _ ||_ _ `.|_ _ \
140+
| | .--.|_/ | | \_| | | `. \ | |_) |
141+
| | / .'`\ \ | | | | | | | __'.
142+
_| |_| \__. | _| |_ _| |_.' /_| |__) |
143+
|_____|'.__.' |_____| |______.'|_______/ Enterprise version 2.0.9.1 (Build: xxxxxxx)
144+
145+
146+
---Last Successful Session------------------
147+
Time: 2026-03-24T10:25:47.759+08:00
148+
IP Address: 127.0.0.1
149+
---Last Failed Session----------------------
150+
Time: 2026-03-24T10:27:26.314+08:00
151+
IP Address: 127.0.0.1
152+
Cumulative Failed Attempts: 1
153+
Successfully logged in at 127.0.0.1:6667
154+
IoTDB>
155+
```
156+
157+
### 4.2 Viewing Access History
158+
159+
The `root` user and users with the `AUDIT` privilege can view login history records using SQL statements.
160+
161+
Syntax:
162+
163+
```SQL
164+
SELECT * FROM __audit.login_history;
165+
```
166+
167+
Example:
168+
169+
```SQL
170+
IoTDB> SELECT * FROM __audit.login_history
171+
+-----------------------------+-------+-------+--------+---------+------+
172+
| time|user_id|node_id|username| ip|result|
173+
+-----------------------------+-------+-------+--------+---------+------+
174+
|2026-03-25T10:55:58.240+08:00| u_0| node_1| root|127.0.0.1| true|
175+
+-----------------------------+-------+-------+--------+---------+------+
176+
Total line number = 1
177+
It costs 0.213s
178+
```

src/UserGuide/latest/Tools-System/CLI_timecho.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,83 @@ It costs 0.267s
193193
```
194194

195195
It should be noted that the use of the -e parameter in shell scripts requires attention to the escaping of special characters.
196+
197+
## 5. Access History Feature
198+
199+
Since IoTDB **V2.0.9.1**, the access history feature is supported. After a client logs in successfully, key historical access information is displayed, and the feature supports distributed scenarios. Both administrators and regular users can only view their own access history. The core displayed information includes:
200+
201+
- Last successful session: displays date, time, access application, IP address, and access method (not shown for first login or when no history exists).
202+
- Most recent failed attempt: displays the date, time, access application, IP address, and access method of the latest failed login attempt before the current successful login.
203+
- Cumulative failed attempts: total number of failed session attempts since the last successful session was established.
204+
205+
### 5.1 Enabling Access History
206+
207+
You can enable or disable the access history feature by modifying relevant parameters in the `iotdb-system.properties` file. A restart is required for changes to take effect. For example:
208+
209+
```Plain
210+
# Controls whether the audit log feature is enabled
211+
enable_audit_log=false
212+
```
213+
214+
- When enabled: login information is recorded and expired data is cleaned periodically.
215+
- When disabled: no data is recorded, displayed, or cleaned.
216+
- If disabled and then re-enabled, the displayed history will be the last record before disabling, which may not represent the actual latest login.
217+
218+
Usage example:
219+
220+
```Bash
221+
---------------------
222+
Starting IoTDB Cli
223+
---------------------
224+
_____ _________ ______ ______
225+
|_ _| | _ _ ||_ _ `.|_ _ \
226+
| | .--.|_/ | | \_| | | `. \ | |_) |
227+
| | / .'`\ \ | | | | | | | __'.
228+
_| |_| \__. | _| |_ _| |_.' /_| |__) |
229+
|_____|'.__.' |_____| |______.'|_______/ Enterprise version 2.0.9.1 (Build: xxxxxxx)
230+
231+
232+
---Last Successful Session------------------
233+
Time: 2026-03-24T10:25:47.759+08:00
234+
IP Address: 127.0.0.1
235+
---Last Failed Session----------------------
236+
Time: 2026-03-24T10:27:26.314+08:00
237+
IP Address: 127.0.0.1
238+
Cumulative Failed Attempts: 1
239+
Successfully login at 127.0.0.1:6667
240+
IoTDB>
241+
```
242+
243+
### 5.2 Viewing Access History
244+
245+
The `root` user and users with the `AUDIT` privilege can view access history records using SQL statements.
246+
247+
Syntax:
248+
249+
```SQL
250+
SELECT * FROM root.__audit.login.u_{userid}.**
251+
```
252+
253+
The `userid` can be obtained using the `LIST USER` statement.
254+
255+
Example:
256+
257+
```SQL
258+
IoTDB> SELECT * FROM root.__audit.login.**
259+
+-----------------------------+------------------------------------+--------------------------------+--------------------------------------+
260+
| Time|root.__audit.login.u_0.node_1.result|root.__audit.login.u_0.node_1.ip|root.__audit.login.u_0.node_1.username|
261+
+-----------------------------+------------------------------------+--------------------------------+--------------------------------------+
262+
|2026-03-25T10:55:58.240+08:00| true| 127.0.0.1| root|
263+
+-----------------------------+------------------------------------+--------------------------------+--------------------------------------+
264+
Total line number = 1
265+
It costs 0.039s
266+
267+
IoTDB> SELECT * FROM root.__audit.login.u_0.**
268+
+-----------------------------+------------------------------------+--------------------------------+--------------------------------------+
269+
| Time|root.__audit.login.u_0.node_1.result|root.__audit.login.u_0.node_1.ip|root.__audit.login.u_0.node_1.username|
270+
+-----------------------------+------------------------------------+--------------------------------+--------------------------------------+
271+
|2026-03-25T10:55:58.240+08:00| true| 127.0.0.1| root|
272+
+-----------------------------+------------------------------------+--------------------------------+--------------------------------------+
273+
Total line number = 1
274+
It costs 0.020s
275+
```

0 commit comments

Comments
 (0)