diff --git a/src/UserGuide/Master/Table/Tools-System/CLI_timecho.md b/src/UserGuide/Master/Table/Tools-System/CLI_timecho.md index c2d2fde6e..484d5b32f 100644 --- a/src/UserGuide/Master/Table/Tools-System/CLI_timecho.md +++ b/src/UserGuide/Master/Table/Tools-System/CLI_timecho.md @@ -107,3 +107,72 @@ To exit the CLI and terminate the session, type`quit`or`exit`. 1. **Navigate Command History:** Use the up and down arrow keys. 2. **Auto-Complete Commands:** Use the right arrow key. 3. **Interrupt Command Execution:** Press `CTRL+C`. + +## 4. Access History Feature + +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: + +- Last successful session: displays date, time, access application, IP address, and access method (not shown for first login or when no history exists). +- 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. +- Cumulative failed attempts: total number of failed session attempts since the last successful session was established. + +### 4.1 Enabling Access History + +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: + +```Plain +# Controls whether the audit log feature is enabled +enable_audit_log=false +``` + +- When enabled: login information is recorded and expired data is cleaned periodically. +- When disabled: no data is recorded, displayed, or cleaned up. +- 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. + +Usage example: + +```Bash +--------------------- +Starting IoTDB Cli +--------------------- + _____ _________ ______ ______ +|_ _| | _ _ ||_ _ `.|_ _ \ + | | .--.|_/ | | \_| | | `. \ | |_) | + | | / .'`\ \ | | | | | | | __'. + _| |_| \__. | _| |_ _| |_.' /_| |__) | +|_____|'.__.' |_____| |______.'|_______/ Enterprise version 2.0.9.1 (Build: xxxxxxx) + + +---Last Successful Session------------------ +Time: 2026-03-24T10:25:47.759+08:00 +IP Address: 127.0.0.1 +---Last Failed Session---------------------- +Time: 2026-03-24T10:27:26.314+08:00 +IP Address: 127.0.0.1 +Cumulative Failed Attempts: 1 +Successfully logged in at 127.0.0.1:6667 +IoTDB> +``` + +### 4.2 Viewing Access History + +The `root` user and users with the `AUDIT` privilege can view login history records using SQL statements. + +Syntax: + +```SQL +SELECT * FROM __audit.login_history; +``` + +Example: + +```SQL +IoTDB> SELECT * FROM __audit.login_history ++-----------------------------+-------+-------+--------+---------+------+ +| time|user_id|node_id|username| ip|result| ++-----------------------------+-------+-------+--------+---------+------+ +|2026-03-25T10:55:58.240+08:00| u_0| node_1| root|127.0.0.1| true| ++-----------------------------+-------+-------+--------+---------+------+ +Total line number = 1 +It costs 0.213s +``` \ No newline at end of file diff --git a/src/UserGuide/Master/Tree/Tools-System/CLI_timecho.md b/src/UserGuide/Master/Tree/Tools-System/CLI_timecho.md index 4ee1198fb..ad512f4ae 100644 --- a/src/UserGuide/Master/Tree/Tools-System/CLI_timecho.md +++ b/src/UserGuide/Master/Tree/Tools-System/CLI_timecho.md @@ -193,3 +193,83 @@ It costs 0.267s ``` It should be noted that the use of the -e parameter in shell scripts requires attention to the escaping of special characters. + +## 5. Access History Feature + +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: + +- Last successful session: displays date, time, access application, IP address, and access method (not shown for first login or when no history exists). +- 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. +- Cumulative failed attempts: total number of failed session attempts since the last successful session was established. + +### 5.1 Enabling Access History + +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: + +```Plain +# Controls whether the audit log feature is enabled +enable_audit_log=false +``` + +- When enabled: login information is recorded and expired data is cleaned periodically. +- When disabled: no data is recorded, displayed, or cleaned. +- If disabled and then re-enabled, the displayed history will be the last record before disabling, which may not represent the actual latest login. + +Usage example: + +```Bash +--------------------- +Starting IoTDB Cli +--------------------- + _____ _________ ______ ______ +|_ _| | _ _ ||_ _ `.|_ _ \ + | | .--.|_/ | | \_| | | `. \ | |_) | + | | / .'`\ \ | | | | | | | __'. + _| |_| \__. | _| |_ _| |_.' /_| |__) | +|_____|'.__.' |_____| |______.'|_______/ Enterprise version 2.0.9.1 (Build: xxxxxxx) + + +---Last Successful Session------------------ +Time: 2026-03-24T10:25:47.759+08:00 +IP Address: 127.0.0.1 +---Last Failed Session---------------------- +Time: 2026-03-24T10:27:26.314+08:00 +IP Address: 127.0.0.1 +Cumulative Failed Attempts: 1 +Successfully login at 127.0.0.1:6667 +IoTDB> +``` + +### 5.2 Viewing Access History + +The `root` user and users with the `AUDIT` privilege can view access history records using SQL statements. + +Syntax: + +```SQL +SELECT * FROM root.__audit.login.u_{userid}.** +``` + +The `userid` can be obtained using the `LIST USER` statement. + +Example: + +```SQL +IoTDB> SELECT * FROM root.__audit.login.** ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +| 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| ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +|2026-03-25T10:55:58.240+08:00| true| 127.0.0.1| root| ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +Total line number = 1 +It costs 0.039s + +IoTDB> SELECT * FROM root.__audit.login.u_0.** ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +| 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| ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +|2026-03-25T10:55:58.240+08:00| true| 127.0.0.1| root| ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +Total line number = 1 +It costs 0.020s +``` \ No newline at end of file diff --git a/src/UserGuide/latest-Table/Tools-System/CLI_timecho.md b/src/UserGuide/latest-Table/Tools-System/CLI_timecho.md index c2d2fde6e..484d5b32f 100644 --- a/src/UserGuide/latest-Table/Tools-System/CLI_timecho.md +++ b/src/UserGuide/latest-Table/Tools-System/CLI_timecho.md @@ -107,3 +107,72 @@ To exit the CLI and terminate the session, type`quit`or`exit`. 1. **Navigate Command History:** Use the up and down arrow keys. 2. **Auto-Complete Commands:** Use the right arrow key. 3. **Interrupt Command Execution:** Press `CTRL+C`. + +## 4. Access History Feature + +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: + +- Last successful session: displays date, time, access application, IP address, and access method (not shown for first login or when no history exists). +- 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. +- Cumulative failed attempts: total number of failed session attempts since the last successful session was established. + +### 4.1 Enabling Access History + +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: + +```Plain +# Controls whether the audit log feature is enabled +enable_audit_log=false +``` + +- When enabled: login information is recorded and expired data is cleaned periodically. +- When disabled: no data is recorded, displayed, or cleaned up. +- 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. + +Usage example: + +```Bash +--------------------- +Starting IoTDB Cli +--------------------- + _____ _________ ______ ______ +|_ _| | _ _ ||_ _ `.|_ _ \ + | | .--.|_/ | | \_| | | `. \ | |_) | + | | / .'`\ \ | | | | | | | __'. + _| |_| \__. | _| |_ _| |_.' /_| |__) | +|_____|'.__.' |_____| |______.'|_______/ Enterprise version 2.0.9.1 (Build: xxxxxxx) + + +---Last Successful Session------------------ +Time: 2026-03-24T10:25:47.759+08:00 +IP Address: 127.0.0.1 +---Last Failed Session---------------------- +Time: 2026-03-24T10:27:26.314+08:00 +IP Address: 127.0.0.1 +Cumulative Failed Attempts: 1 +Successfully logged in at 127.0.0.1:6667 +IoTDB> +``` + +### 4.2 Viewing Access History + +The `root` user and users with the `AUDIT` privilege can view login history records using SQL statements. + +Syntax: + +```SQL +SELECT * FROM __audit.login_history; +``` + +Example: + +```SQL +IoTDB> SELECT * FROM __audit.login_history ++-----------------------------+-------+-------+--------+---------+------+ +| time|user_id|node_id|username| ip|result| ++-----------------------------+-------+-------+--------+---------+------+ +|2026-03-25T10:55:58.240+08:00| u_0| node_1| root|127.0.0.1| true| ++-----------------------------+-------+-------+--------+---------+------+ +Total line number = 1 +It costs 0.213s +``` \ No newline at end of file diff --git a/src/UserGuide/latest/Tools-System/CLI_timecho.md b/src/UserGuide/latest/Tools-System/CLI_timecho.md index 4ee1198fb..ad512f4ae 100644 --- a/src/UserGuide/latest/Tools-System/CLI_timecho.md +++ b/src/UserGuide/latest/Tools-System/CLI_timecho.md @@ -193,3 +193,83 @@ It costs 0.267s ``` It should be noted that the use of the -e parameter in shell scripts requires attention to the escaping of special characters. + +## 5. Access History Feature + +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: + +- Last successful session: displays date, time, access application, IP address, and access method (not shown for first login or when no history exists). +- 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. +- Cumulative failed attempts: total number of failed session attempts since the last successful session was established. + +### 5.1 Enabling Access History + +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: + +```Plain +# Controls whether the audit log feature is enabled +enable_audit_log=false +``` + +- When enabled: login information is recorded and expired data is cleaned periodically. +- When disabled: no data is recorded, displayed, or cleaned. +- If disabled and then re-enabled, the displayed history will be the last record before disabling, which may not represent the actual latest login. + +Usage example: + +```Bash +--------------------- +Starting IoTDB Cli +--------------------- + _____ _________ ______ ______ +|_ _| | _ _ ||_ _ `.|_ _ \ + | | .--.|_/ | | \_| | | `. \ | |_) | + | | / .'`\ \ | | | | | | | __'. + _| |_| \__. | _| |_ _| |_.' /_| |__) | +|_____|'.__.' |_____| |______.'|_______/ Enterprise version 2.0.9.1 (Build: xxxxxxx) + + +---Last Successful Session------------------ +Time: 2026-03-24T10:25:47.759+08:00 +IP Address: 127.0.0.1 +---Last Failed Session---------------------- +Time: 2026-03-24T10:27:26.314+08:00 +IP Address: 127.0.0.1 +Cumulative Failed Attempts: 1 +Successfully login at 127.0.0.1:6667 +IoTDB> +``` + +### 5.2 Viewing Access History + +The `root` user and users with the `AUDIT` privilege can view access history records using SQL statements. + +Syntax: + +```SQL +SELECT * FROM root.__audit.login.u_{userid}.** +``` + +The `userid` can be obtained using the `LIST USER` statement. + +Example: + +```SQL +IoTDB> SELECT * FROM root.__audit.login.** ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +| 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| ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +|2026-03-25T10:55:58.240+08:00| true| 127.0.0.1| root| ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +Total line number = 1 +It costs 0.039s + +IoTDB> SELECT * FROM root.__audit.login.u_0.** ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +| 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| ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +|2026-03-25T10:55:58.240+08:00| true| 127.0.0.1| root| ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +Total line number = 1 +It costs 0.020s +``` \ No newline at end of file diff --git a/src/zh/UserGuide/Master/Table/Tools-System/CLI_timecho.md b/src/zh/UserGuide/Master/Table/Tools-System/CLI_timecho.md index 7b7bcf538..0e6ed52c4 100644 --- a/src/zh/UserGuide/Master/Table/Tools-System/CLI_timecho.md +++ b/src/zh/UserGuide/Master/Table/Tools-System/CLI_timecho.md @@ -85,8 +85,9 @@ Shell> sbin\windows\start-cli.bat -h 127.0.0.1 -p 6667 -u root -pw TimechoDB@202 ![](/img/Cli-01.png) +## 2. CLI 使用 -## 2. 在 CLI 中执行语句 +### 2.1 执行语句 进入 CLI 后,用户可以直接在对话中输入 SQL 语句进行交互。如: @@ -108,16 +109,85 @@ show databases ![](/img/Cli-03.png) +### 2.2 命令技巧 + +CLI中使用命令小技巧: + +(1)快速切换历史命令: 上下箭头 + +(2)历史命令自动补全:右箭头 + +(3)中断执行命令: CTRL+C + ## 3. CLI 退出 在 CLI 中输入`quit`或`exit`可退出 CLI 结束本次会话。 -## 4. 其他说明 +## 4. 访问历史功能 -CLI中使用命令小技巧: +IoTDB **V2.0.9.1** 起支持开启访问历史功能,即客户端登录成功后展示关键的历史访问信息,支持分布式场景。管理员与普通用户仅可查看自身访问历史,核心展示内容包括: -(1)快速切换历史命令: 上下箭头 +* 上一次成功会话:显示日期、时间、访问应用、IP地址及访问方法(首次登录或无历史记录时不显示)。 +* 最近一次失败尝试:显示距离本次成功登录时间最近的一次失败记录的日期、时间、访问应用、IP地址及访问方法。 +* 累计失败次数:统计自上一次成功会话建立以来,所有未成功建立的会话尝试总次数。 -(2)历史命令自动补全:右箭头 +### 4.1 开启访问历史 -(3)中断执行命令: CTRL+C \ No newline at end of file +支持通过修改 `iotdb-system.properties` 文件中的相关参数来控制是否开启访问历史功能,修改参数后需重启生效,例如: + +```Plain +# 用于控制是否启用审计日志功能 +enable_audit_log=false +``` + +* 开启时,记录登录信息并定期清理过期数据; +* 关闭时,不记录、不展示、不清理; +* 开关关闭后重开,展示的历史为关闭前最后一条记录,不一定代表真实最近登录记录。 + +使用示例: + +```Bash +--------------------- +Starting IoTDB Cli +--------------------- + _____ _________ ______ ______ +|_ _| | _ _ ||_ _ `.|_ _ \ + | | .--.|_/ | | \_| | | `. \ | |_) | + | | / .'`\ \ | | | | | | | __'. + _| |_| \__. | _| |_ _| |_.' /_| |__) | +|_____|'.__.' |_____| |______.'|_______/ Enterprise version 2.0.9.1 (Build: xxxxxxx) + + +---Last Successful Session------------------ +Time: 2026-03-24T10:25:47.759+08:00 +IP Address: 127.0.0.1 +---Last Failed Session---------------------- +Time: 2026-03-24T10:27:26.314+08:00 +IP Address: 127.0.0.1 +Cumulative Failed Attempts: 1 +Successfully login at 127.0.0.1:6667 +IoTDB> +``` + +### 4.2 查看访问历史 + +root 用户及具有 AUDIT 权限的用户可以通过 SQL 语句查看访问历史记录。 + +语法定义: + +```SQL +select * from __audit.login_history; +``` + +示例: + +```SQL +IoTDB> select * from __audit.login_history ++-----------------------------+-------+-------+--------+---------+------+ +| time|user_id|node_id|username| ip|result| ++-----------------------------+-------+-------+--------+---------+------+ +|2026-03-25T10:55:58.240+08:00| u_0| node_1| root|127.0.0.1| true| ++-----------------------------+-------+-------+--------+---------+------+ +Total line number = 1 +It costs 0.213s +``` diff --git a/src/zh/UserGuide/Master/Tree/Tools-System/CLI_timecho.md b/src/zh/UserGuide/Master/Tree/Tools-System/CLI_timecho.md index 49e1b32f9..8904f07d0 100644 --- a/src/zh/UserGuide/Master/Tree/Tools-System/CLI_timecho.md +++ b/src/zh/UserGuide/Master/Tree/Tools-System/CLI_timecho.md @@ -185,3 +185,81 @@ It costs 0.267s 需要特别注意的是,在脚本中使用 -e 参数时要对特殊字符进行转义。 +## 5. 访问历史功能 + +IoTDB **V2.0.9.1** 起支持开启访问历史功能,即客户端登录成功后展示关键的历史访问信息,支持分布式场景。管理员与普通用户仅可查看自身访问历史,核心展示内容包括: + +* 上一次成功会话:显示日期、时间、访问应用、IP地址及访问方法(首次登录或无历史记录时不显示)。 +* 最近一次失败尝试:显示距离本次成功登录时间最近的一次失败记录的日期、时间、访问应用、IP地址及访问方法。 +* 累计失败次数:统计自上一次成功会话建立以来,所有未成功建立的会话尝试总次数。 + +### 5.1 开启访问历史 + +支持通过修改 `iotdb-system.properties` 文件中的相关参数来控制是否开启访问历史功能,修改参数后需重启生效,例如: + +```Plain +# 用于控制是否启用审计日志功能 +enable_audit_log=false +``` + +* 开启时,记录登录信息并定期清理过期数据; +* 关闭时,不记录、不展示、不清理; +* 开关关闭后重开,展示的历史为关闭前最后一条记录,不一定代表真实最近登录记录。 + +使用示例: + +```Bash +--------------------- +Starting IoTDB Cli +--------------------- + _____ _________ ______ ______ +|_ _| | _ _ ||_ _ `.|_ _ \ + | | .--.|_/ | | \_| | | `. \ | |_) | + | | / .'`\ \ | | | | | | | __'. + _| |_| \__. | _| |_ _| |_.' /_| |__) | +|_____|'.__.' |_____| |______.'|_______/ Enterprise version 2.0.9.1 (Build: xxxxxxx) + + +---Last Successful Session------------------ +Time: 2026-03-24T10:25:47.759+08:00 +IP Address: 127.0.0.1 +---Last Failed Session---------------------- +Time: 2026-03-24T10:27:26.314+08:00 +IP Address: 127.0.0.1 +Cumulative Failed Attempts: 1 +Successfully login at 127.0.0.1:6667 +IoTDB> +``` + +### 5.2 查看访问历史 + +root 用户及具有 AUDIT 权限的用户可以通过 SQL 语句查看访问历史记录。 + +语法定义: + +```SQL +select * from root.__audit.login.u_{userid}.** +``` + +其中 userid 可通过 `list user` 语句查看。 + +示例: + +```SQL +IoTDB> select * from root.__audit.login.** ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +| 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| ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +|2026-03-25T10:55:58.240+08:00| true| 127.0.0.1| root| ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +Total line number = 1 +It costs 0.039s +IoTDB> select * from root.__audit.login.u_0.** ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +| 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| ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +|2026-03-25T10:55:58.240+08:00| true| 127.0.0.1| root| ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +Total line number = 1 +It costs 0.020s +``` diff --git a/src/zh/UserGuide/latest-Table/Tools-System/CLI_timecho.md b/src/zh/UserGuide/latest-Table/Tools-System/CLI_timecho.md index 7b7bcf538..1df7d5e04 100644 --- a/src/zh/UserGuide/latest-Table/Tools-System/CLI_timecho.md +++ b/src/zh/UserGuide/latest-Table/Tools-System/CLI_timecho.md @@ -85,8 +85,9 @@ Shell> sbin\windows\start-cli.bat -h 127.0.0.1 -p 6667 -u root -pw TimechoDB@202 ![](/img/Cli-01.png) +## 2. CLI 使用 -## 2. 在 CLI 中执行语句 +### 2.1 执行语句 进入 CLI 后,用户可以直接在对话中输入 SQL 语句进行交互。如: @@ -108,16 +109,87 @@ show databases ![](/img/Cli-03.png) +### 2.2 命令技巧 + +CLI中使用命令小技巧: + +(1)快速切换历史命令: 上下箭头 + +(2)历史命令自动补全:右箭头 + +(3)中断执行命令: CTRL+C + ## 3. CLI 退出 在 CLI 中输入`quit`或`exit`可退出 CLI 结束本次会话。 -## 4. 其他说明 +## 4. 访问历史功能 -CLI中使用命令小技巧: +IoTDB **V2.0.9.1** 起支持开启访问历史功能,即客户端登录成功后展示关键的历史访问信息,支持分布式场景。管理员与普通用户仅可查看自身访问历史,核心展示内容包括: -(1)快速切换历史命令: 上下箭头 +* 上一次成功会话:显示日期、时间、访问应用、IP地址及访问方法(首次登录或无历史记录时不显示)。 +* 最近一次失败尝试:显示距离本次成功登录时间最近的一次失败记录的日期、时间、访问应用、IP地址及访问方法。 +* 累计失败次数:统计自上一次成功会话建立以来,所有未成功建立的会话尝试总次数。 + +### 4.1 开启访问历史 + +支持通过修改 `iotdb-system.properties` 文件中的相关参数来控制是否开启访问历史功能,修改参数后需重启生效,例如: + +```Plain +# 用于控制是否启用审计日志功能 +enable_audit_log=false +``` + +* 开启时,记录登录信息并定期清理过期数据; +* 关闭时,不记录、不展示、不清理; +* 开关关闭后重开,展示的历史为关闭前最后一条记录,不一定代表真实最近登录记录。 + +使用示例: + +```Bash +--------------------- +Starting IoTDB Cli +--------------------- + _____ _________ ______ ______ +|_ _| | _ _ ||_ _ `.|_ _ \ + | | .--.|_/ | | \_| | | `. \ | |_) | + | | / .'`\ \ | | | | | | | __'. + _| |_| \__. | _| |_ _| |_.' /_| |__) | +|_____|'.__.' |_____| |______.'|_______/ Enterprise version 2.0.9.1 (Build: xxxxxxx) + + +---Last Successful Session------------------ +Time: 2026-03-24T10:25:47.759+08:00 +IP Address: 127.0.0.1 +---Last Failed Session---------------------- +Time: 2026-03-24T10:27:26.314+08:00 +IP Address: 127.0.0.1 +Cumulative Failed Attempts: 1 +Successfully login at 127.0.0.1:6667 +IoTDB> +``` + +### 4.2 查看访问历史 + +root 用户及具有 AUDIT 权限的用户可以通过 SQL 语句查看访问历史记录。 + +语法定义: + +```SQL +select * from __audit.login_history; +``` + +示例: + +```SQL +IoTDB> select * from __audit.login_history ++-----------------------------+-------+-------+--------+---------+------+ +| time|user_id|node_id|username| ip|result| ++-----------------------------+-------+-------+--------+---------+------+ +|2026-03-25T10:55:58.240+08:00| u_0| node_1| root|127.0.0.1| true| ++-----------------------------+-------+-------+--------+---------+------+ +Total line number = 1 +It costs 0.213s +``` -(2)历史命令自动补全:右箭头 -(3)中断执行命令: CTRL+C \ No newline at end of file diff --git a/src/zh/UserGuide/latest/Tools-System/CLI_timecho.md b/src/zh/UserGuide/latest/Tools-System/CLI_timecho.md index 49e1b32f9..8904f07d0 100644 --- a/src/zh/UserGuide/latest/Tools-System/CLI_timecho.md +++ b/src/zh/UserGuide/latest/Tools-System/CLI_timecho.md @@ -185,3 +185,81 @@ It costs 0.267s 需要特别注意的是,在脚本中使用 -e 参数时要对特殊字符进行转义。 +## 5. 访问历史功能 + +IoTDB **V2.0.9.1** 起支持开启访问历史功能,即客户端登录成功后展示关键的历史访问信息,支持分布式场景。管理员与普通用户仅可查看自身访问历史,核心展示内容包括: + +* 上一次成功会话:显示日期、时间、访问应用、IP地址及访问方法(首次登录或无历史记录时不显示)。 +* 最近一次失败尝试:显示距离本次成功登录时间最近的一次失败记录的日期、时间、访问应用、IP地址及访问方法。 +* 累计失败次数:统计自上一次成功会话建立以来,所有未成功建立的会话尝试总次数。 + +### 5.1 开启访问历史 + +支持通过修改 `iotdb-system.properties` 文件中的相关参数来控制是否开启访问历史功能,修改参数后需重启生效,例如: + +```Plain +# 用于控制是否启用审计日志功能 +enable_audit_log=false +``` + +* 开启时,记录登录信息并定期清理过期数据; +* 关闭时,不记录、不展示、不清理; +* 开关关闭后重开,展示的历史为关闭前最后一条记录,不一定代表真实最近登录记录。 + +使用示例: + +```Bash +--------------------- +Starting IoTDB Cli +--------------------- + _____ _________ ______ ______ +|_ _| | _ _ ||_ _ `.|_ _ \ + | | .--.|_/ | | \_| | | `. \ | |_) | + | | / .'`\ \ | | | | | | | __'. + _| |_| \__. | _| |_ _| |_.' /_| |__) | +|_____|'.__.' |_____| |______.'|_______/ Enterprise version 2.0.9.1 (Build: xxxxxxx) + + +---Last Successful Session------------------ +Time: 2026-03-24T10:25:47.759+08:00 +IP Address: 127.0.0.1 +---Last Failed Session---------------------- +Time: 2026-03-24T10:27:26.314+08:00 +IP Address: 127.0.0.1 +Cumulative Failed Attempts: 1 +Successfully login at 127.0.0.1:6667 +IoTDB> +``` + +### 5.2 查看访问历史 + +root 用户及具有 AUDIT 权限的用户可以通过 SQL 语句查看访问历史记录。 + +语法定义: + +```SQL +select * from root.__audit.login.u_{userid}.** +``` + +其中 userid 可通过 `list user` 语句查看。 + +示例: + +```SQL +IoTDB> select * from root.__audit.login.** ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +| 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| ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +|2026-03-25T10:55:58.240+08:00| true| 127.0.0.1| root| ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +Total line number = 1 +It costs 0.039s +IoTDB> select * from root.__audit.login.u_0.** ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +| 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| ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +|2026-03-25T10:55:58.240+08:00| true| 127.0.0.1| root| ++-----------------------------+------------------------------------+--------------------------------+--------------------------------------+ +Total line number = 1 +It costs 0.020s +```