This topic describes the fields that are included in audit logs of PolarDB-X databases.

Field Type Description
__topic__ string The topic to which PolarDB-X logs belong. The value is polardbx_sqlaudit.
instance_id string The ID of the PolarDB-X instance.
db_name string The name of the PolarDB-X database.
client_ip string The IP address of the client that accesses the PolarDB-X instance.
client_port int The port over which the client accesses the PolarDB-X instance.
user string The username of the account that is used to perform the operation.
sql string The SQL statement that is executed.
response_time int The response time. Unit: ms.
affect_rows int
  • If a DML statement is executed, this field indicates the number of rows on which the operation is performed.
  • If a query statement is executed, this field indicates the number of returned data rows.
trace_id string The trace ID that is generated for the SQL request.
fail int This field indicates whether the SQL query fails. Valid values:
  • 0: The SQL request is successful.
  • 1: The SQL request fails.
hint string The hint that is used in the SQL statement.
table_name string The tables on which the SQL statement is executed. Multiple table names are separated with commas (,).
sql_type string The type of the SQL statement. Valid values:
  • SELECT
  • INSERT
  • DELETE
  • UPDATE
  • SET
  • ALTER
  • CREATE
  • DROP
  • TRUNCATE
  • REPLACE
  • OTHER
sql_type_detail string The name of the SQL parser.
sql_time datetime The UTC time when the system starts to execute the SQL statement. The time is displayed in the yyyy-MM-dd HH:mm:ss.SSS format.
sql_code string The hash value of the SQL template.
transaction_id string The ID of the transaction.
autocommit int This field indicates whether the autocommit mode is enabled when the SQL statement is executed. Valid values:
  • 0: The autocommit mode is disabled.
  • 1 or NULL: The autocommit mode is enabled.
transaction_policy string The transaction policy based on which the SQL statement is executed. Valid values:
  • Empty value: The transaction processing feature is disabled.
  • TSO: Timestamp oracle (TSO) transactions are executed on the PolarDB-X database. This is the default value.
  • BEST_EFFORT: Two-phase commit (2PC) transactions are executed on the PolarDB-X database.
workload_type string The type of the processor that is used when the SQL statement is executed. Valid values:
  • TP: transaction processor
  • AP: analysis processor