Skip to content

docs: add tidb_general_log to TiDB configuration reference (#24014) - #24735

Merged
ti-chi-bot[bot] merged 5 commits into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-24014-to-release-8.5
Nov 20, 2026
Merged

ti-chi-bot[bot] merged 5 commits into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-24014-to-release-8.5

Conversation

@ti-chi-bot

@ti-chi-bot ti-chi-bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

This is an automated cherry-pick of #24014

What is changed, added or deleted? (Required)

  • Add the missing instance.tidb_general_log entry to tidb-configuration-file.md.
  • Document the default value and boolean options so the permanent instance-level general query log setting is covered in the configuration reference.

Which TiDB version(s) do your changes apply to? (Required)

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions.

  • master (the latest development version)
  • v8.5 (TiDB 8.5 versions)
  • v8.4 (TiDB 8.4 versions)
  • v8.3 (TiDB 8.3 versions)
  • v8.2 (TiDB 8.2 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)
  • v6.1 (TiDB 6.1 versions)
  • v5.4 (TiDB 5.4 versions)
  • v5.3 (TiDB 5.3 versions)

What is the related PR or file link(s)?

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

Summary by CodeRabbit

  • Documentation
    • Clarified that the general log records statements after compilation and before execution, including statements that fail during execution. Statements that fail to parse or compile are not recorded.
    • Clarified that general log entries are written at the info level regardless of the configured log level and can be found by searching for "GENERAL_LOG".
    • Documented the instance-level setting, including its false default and supported true or false values.

@ti-chi-bot ti-chi-bot added area/general Relates to TiDB overview, architecture, and other general descriptions. contribution This PR is from a community contributor. lgtm needs-1-more-lgtm Indicates a PR needs 1 more LGTM. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. type/bugfix This PR fixes a bug. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR. labels Nov 20, 2026
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

Walkthrough

The documentation updates describe general-log recording behavior and add the instance.tidb_general_log configuration entry, including its default and accepted values.

Changes: General log documentation

Layer / File(s) Summary
General log behavior and configuration
system-variables.md, tidb-configuration-file.md
The system variable documentation states that compiled statements are logged even if execution fails, while parse- or compilation-failing statements are excluded. It also states that entries use the info level regardless of log.level. The configuration documentation adds instance.tidb_general_log, its default of false, and its accepted values.

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Other

Suggested reviewers: qiancai, lilin90

Merge Risk: Low · up to 567d6

This PR documents the instance.tidb_general_log setting and clarifies general-log behavior. The docs still overstate what the general log records: DDL such as CREATE TABLE goes to a different log entry. They also list field names that do not match the emitted log keys. Readers may search or filter for the wrong strings. There is no runtime risk, and the fixes are small.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the change: adding tidb_general_log to the TiDB configuration reference. The raw summary confirms that tidb-configuration-file.md gained an instance.tidb_general_log entry. The title d…
Description check Passed The description follows the repository template. It includes the 'What is changed' section with a clear summary, the affected-version checkboxes (master and v8.5 ticked), and the related reference lin…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the change: adding tidb_general_log to the TiDB configuration reference. The raw summary confirms that tidb-configuration-file.md gained an instance.tidb_general_log entry. The title does not mention the system-variable documentation change in system-variables.md, which is a secondary part of the changeset. The title is specific and matches the main change.

Full details: Description check

Explanation

The description follows the repository template. It includes the 'What is changed' section with a clear summary, the affected-version checkboxes (master and v8.5 ticked), and the related reference link. It omits the first-time contributor checklist, which is optional. The 'AI agent involvement' section is absent from the author's version. The description does not mention the system-variables.md changes, which the raw summary shows are part of this PR. Its scope statement is incomplete relative to the actual changes.

Resolution

Optionally, mention the system-variables.md wording change (general log timing, log level independence, and the GENERAL_LOG search string) in the 'What is changed' section so the description matches the full changeset.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Correct the general-log field names. · system-variables.md:3336-3337

system-variables.md:3336-3337
Minor · Data Integrity & Integration · Quick win

Correct the general-log field names.

The v8.5.0 logger emits currentDB and sessionTxnMode, not current_db and txn_mode. Readers using the new GENERAL_LOG search guidance can otherwise build filters for keys that do not exist. Update the field list to match the emitted keys. (raw.githubusercontent.com)

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 540e2d9 and 567d618.

Files selected for processing: 2

  • system-variables.md
  • tidb-configuration-file.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread system-variables.md
- The [`tidb_redact_log`](#tidb_redact_log) variable enables you to redact SQL statements recorded in the general log.

- Only successfully executed statements are logged in the general log. Failed statements are not recorded in the general log but are instead logged in the TiDB log with a `command dispatched failed` message.
- The general log records SQL statements after compilation and before execution, so statements that fail during execution might also be recorded. Statements that fail during parsing or compilation are not recorded in the general log.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Document that DDL statements are not recorded in the general log.

The general log does not record DDL statements, such as CREATE TABLE. TiDB writes these statements as CRUCIAL OPERATION entries in the TiDB log, whether or not general logging is enabled. Searching for "GENERAL_LOG", as this section instructs, misses them. The opening sentence also says the variable records "all SQL statements," which conflicts with the exclusions later in this section.

Suggested documentation change

-This variable is used to set whether to record all SQL statements in the [log](/tidb-configuration-file.md#logfile).
+This variable is used to set whether to record SQL statements in the [log](/tidb-configuration-file.md#logfile).
 - The general log records SQL statements after compilation and before execution, so statements that fail during execution might also be recorded. Statements that fail during parsing or compilation are not recorded in the general log.
+- DDL statements, such as `CREATE TABLE`, are not recorded in the general log. TiDB records them as `CRUCIAL OPERATION` entries in the TiDB log. To find them, search for the `"CRUCIAL OPERATION"` string.
Committable suggestion

IMPORTANT
Review the replacement and indentation, then test before committing.

Suggested change
- The general log records SQL statements after compilation and before execution, so statements that fail during execution might also be recorded. Statements that fail during parsing or compilation are not recorded in the general log.
- The general log records SQL statements after compilation and before execution, so statements that fail during execution might also be recorded. Statements that fail during parsing or compilation are not recorded in the general log.
- DDL statements, such as `CREATE TABLE`, are not recorded in the general log. TiDB records them as `CRUCIAL OPERATION` entries in the TiDB log. To find them, search for the `"CRUCIAL OPERATION"` string.

@qiancai

qiancai commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

/approve

@ti-chi-bot

ti-chi-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qiancai

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added the approved label Nov 20, 2026
@ti-chi-bot
ti-chi-bot Bot merged commit 9d9da3a into pingcap:release-8.5 Nov 20, 2026
12 checks passed
@ti-chi-bot
ti-chi-bot Bot deleted the cherry-pick-24014-to-release-8.5 branch November 20, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved area/general Relates to TiDB overview, architecture, and other general descriptions. contribution This PR is from a community contributor. lgtm needs-1-more-lgtm Indicates a PR needs 1 more LGTM. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. type/bugfix This PR fixes a bug. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants