File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2750,7 +2750,12 @@ v5.0 后,用户仍可以单独修改以上系统变量(会有废弃警告)
27502750- 类型:布尔型
27512751- 默认值:` OFF`
27522752- 这个变量用来设置是否在[日志](/ tidb- configuration- file .md # logfile)里记录所有的 SQL 语句。该功能默认关闭。如果系统运维人员在定位问题过程中需要追踪所有 SQL 记录,可考虑开启该功能。
2753+ - 如果指定了 [` log.general-log-file` ](/ tidb- configuration- file .md # general-log-file-从-v800-版本开始引入) 配置项,general log 将被单独写入到指定的文件中。
2754+ - 通过 [` log.format` ](/ tidb- configuration- file .md # format) 配置项可以配置日志消息的格式,无论 general log 是在单独的文件中还是合并在其它日志文件中。
2755+ - 通过 [` tidb_redact_log` ](# tidb_redact_log) 变量可以对 general log 中记录的 SQL 语句进行脱敏处理。
2756+ - 只有执行成功的语句才会被记录在 general log 中。失败的语句不会记录在 general log 中,而是以 ` command dispatched failed` 消息的形式记录在 TiDB 日志中。
27532757- 在 TiDB 配置项 [` log.level` ](/ tidb- configuration- file .md # level) 为 `"info"` 或 `"debug"` 时,通过查询 `"GENERAL_LOG"` 字符串可以定位到该功能在日志中的所有记录。日志会记录以下内容:
2758+ - ` time` :事件发生时间
27542759 - ` conn` :当前会话对应的 ID
27552760 - ` user` :当前会话用户
27562761 - ` schemaVersion` :当前 schema 版本
You can’t perform that action at this time.
0 commit comments