obproxy_digest.log records OceanBase Database Proxy (ODP) audit logs, including logs for SQL queries whose execution time exceeds query_digest_time_threshold (100 ms by default) and logs for failed SQL queries.
Log format
The general format of logs in obproxy_digest.log is as follows:
Log printing time,Logical tenant name,TraceId,RpcId,Logical database name,Physical database information (cluster:tenant:database),Database type (OB/RDS),Logical table name,Physical table name,SQL command,SQL type (CRUD),Execution result (success/failed),Error Code (empty for success),SQL statement,Total execution time (μs),ODP processing time,Connection establishment time,OBServer node execution time,Current thread name,Ignorable fields
where
The
SQL commandcan beCOM_QUERYorCOM_STMT_PREPARE.The
total execution timeincludes the internal SQL execution time.The
current thread nameindicates the internal thread ID in ODP.All
ignorable fieldsare for internal use. You do not need to pay attention to them.
Examples
Use select sleep(3) from dual to simulate a slow SQL query. After the SQL query is executed, check obproxy_digest.log. The log shows that ODP takes 409 μs to execute the query and OceanBase Database takes 3,039,883 μs to execute the query. The log content is as follows:
2022-07-11 14:32:51.758265,undefined,,,,obcluster:sys:test,OB_MYSQL,,,COM_QUERY,SELECT,success,,select sleep(3),3041116us,409us,0us,3039883us,Y0-7F4B1CEA13A0,,,,0,11.xxx.xxx.53:33041
# The log fields are separated with commas (,). If the SQL statement contains a comma, it will be replaced with %2C. The result after replacement by using tr ',' '\n' is as follows:
1,2022-07-11 14:32:51.758265 # The log printing time.
2,undefined # The logical tenant name. You can ignore this field.
3, # The trace ID. You can ignore this field.
4, # The RPC ID. You can ignore this field.
5, # The logical database name. You can ignore this field.
6,obcluster:sys:test # The information about the physical database, in the format of cluster name:tenant name:database name.
7,OB_MYSQL # The database type.
8, # The name of the logical table.
9, # The name of the physical table.
10,COM_QUERY # The SQL command, for example, COM_QUERY or COM_STMT_PREPARE.
11,SELECT # The SQL type.
12,success # The execution result, which is success or failed.
13, # The error code, which is empty when the execution result is success.
14,select sleep(3) # The SQL statement.
15,3041116us # The total execution time, including the internal SQL execution time.
16,409us # The ODP processing time.
17,0us # The connection establishment time.
18,3039883us # The OBServer node execution time.
19,Y0-7F4B1CEA13A0 # The internal trace ID of the log in ODP.
20, # It is for internal use. You can ignore it.
21, # It is for internal use. You can ignore it.
22, # It is for internal use. You can ignore it.
23,0 # It is for internal use. You can ignore it.
24,11.xxx.xxx.53:33041 # The address of the routing destination OBServer node.
In an audit log, line 14 records the executed SQL statement, and line 15 and line 16 record the detailed execution time. If the execution in the database is slow, the time recorded in line 18 will be long.
References
For more information about the query_digest_time_threshold parameter, see query_digest_time_threshold.