Queries full column store audit logs by using streaming.
Operation description
Try it now
Test
RAM authorization
Request syntax
POST / HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID of the request. The value must match the region where the SQLQuery service is deployed. |
cn-hangzhou |
| DBInstanceName |
string |
Yes |
The ID of the PolarDB-X instance whose column store audit logs you want to query. |
pxc-******** |
| SQL |
string |
Yes |
The read-only query statement to execute. Only a single MySQL SELECT statement is supported. The query table must use the fully qualified form polardbx_sls.<table_name>, and only the following tables are allowed: polardbx_sls.polardbx_log (kernel logs), polardbx_sls.slow_detail_log (slow query logs), polardbx_sls.slow_trans_log (slow transaction logs), and polardbx_sls.sql_audit_log (audit logs). Multi-statement queries, write operations, locks, user variables, dynamic placeholders, and reserved hints are not supported. |
SELECT * FROM polardbx_sls.sql_audit_log LIMIT 100 |
| MaxResultRows |
integer |
No |
The maximum number of result rows to return for this request. Valid values: 1 to 10000. If this parameter is not specified, no additional row limit is applied to the SQL statement submitted by the caller. The result is still subject to the server-side SSE upper limit of 10000 rows and the top-level LIMIT clause in the SQL statement. |
1000 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Type |
string |
The SSE event type. RECORD carries a batch of query results. EOF indicates that the query has completed. ERROR indicates that the query ended with an exception. |
RECORD |
| RequestId |
string |
The request ID. The same ID is used across all stages of the request, including access, authentication, routing, query execution, and all SSE events, to facilitate end-to-end troubleshooting. |
C457B28E-9CAB-4B77-B5C6-5D71B7870B6E |
| QueryId |
string |
The unique identifier generated by the service for this JDBC query. All events in the same SSE stream share the same QueryId. |
5d3d88ea-3df0-4c2d-a8bb-2ec423b86b56 |
| Sequence |
integer |
The sequence number of the RECORD event, starting from 1 and incrementing. This field indicates the event order and does not represent the result row offset. |
1 |
| Code |
string |
The stable error code. This field is returned only when Type is ERROR. Handle errors based on this field instead of relying on the Message text. |
InternalError |
| Message |
string |
The error summary. This field is returned only when Type is ERROR. |
Query execution failed |
| Retryable |
boolean |
Indicates whether the current ERROR is suitable for retry. A value of true indicates that you can retry the request based on the suggestion returned with the error. A value of false indicates that you need to modify the request or contact the service team for troubleshooting. |
true |
| Partial |
boolean |
Indicates whether at least one RECORD event was sent before the ERROR occurred. A value of true indicates that the results already received by the caller are incomplete and should not be treated as complete query results. |
|
| AccessDeniedDetail |
object |
The details of the access denial. |
|
| AuthAction |
string |
As described above. |
polardbx:QueryColumnarLogSSE |
| AuthPrincipalType |
string |
The identity type used for authentication in the request. Valid values:
|
222 |
| AuthPrincipalOwnerId |
string |
The owner ID of the authentication principal. |
111 |
| AuthPrincipalDisplayName |
string |
The display name of the authentication principal. |
Sample RAM user |
| PolicyType |
string |
The policy type. |
PRIORITY |
| NoPermissionType |
string |
The type of the permission denial. |
ImplicitDeny |
| EncodedDiagnosticMessage |
string |
The encoded diagnostic message. |
AQEAAAAAaKPfwjY0MzMyODRGLUZCQkQtNTA1RS04MUUxLTc5NTkzODk2MUIzMg== |
| Records |
array<object> |
Returned only when Type is RECORD. A batch of query results carried by this event. Each row is a JSON key-value object that maps column names to text values. SQL NULL is encoded as the string null. |
|
|
object |
The data table field. |
||
|
string |
The value of a single column in the query result. All scalars are returned as strings. SQL NULL is encoded as the string null. An empty string remains an empty string. |
null |
|
| AppliedOffset |
integer |
Returned only when Type is EOF. The top-level SQL LIMIT offset actually applied by the service. The value is 0 if the SQL statement does not specify an offset. |
0 |
| AppliedRowLimit |
integer |
Returned only when Type is EOF. The maximum number of rows actually applied by the service after combining the top-level SQL LIMIT, MaxResultRows, and the current service policy. This value does not include the extra row used to detect HasMore. |
1000 |
| ReturnedRowCount |
integer |
Returned only when Type is EOF. The total number of result rows actually returned in this SSE stream. |
100 |
| HasMore |
boolean |
Returned only when Type is EOF. Indicates whether the service or API row limit truncated the SQL statement submitted by the caller. A value of false when the SQL statement completes with a smaller LIMIT does not indicate that no more data exists in the underlying table. |
False |
| RecordsSizeBytes |
integer |
Returned only when Type is EOF. The total UTF-8 byte size of all returned row JSON objects. This value does not include arrays, SSE frames, or fixed response fields. |
8192 |
| QueryElapsedTimeMilliseconds |
integer |
Returned only when Type is EOF. The elapsed time in milliseconds from the start of JDBC statement execution to the completion of reading the last result row or probe row. |
125 |
Examples
Success response
JSON format
{
"Type": "RECORD",
"RequestId": "C457B28E-9CAB-4B77-B5C6-5D71B7870B6E",
"QueryId": "5d3d88ea-3df0-4c2d-a8bb-2ec423b86b56",
"Sequence": 1,
"Code": "InternalError",
"Message": "Query execution failed",
"Retryable": true,
"Partial": false,
"AccessDeniedDetail": {
"AuthAction": "xxx",
"AuthPrincipalType": "222",
"AuthPrincipalOwnerId": "111",
"AuthPrincipalDisplayName": "xxx",
"PolicyType": "PRIORITY",
"NoPermissionType": "ImplicitDeny",
"EncodedDiagnosticMessage": "AQEAAAAAaKPfwjY0MzMyODRGLUZCQkQtNTA1RS04MUUxLTc5NTkzODk2MUIzMg=="
},
"Records": [
{
"key": "null"
}
],
"AppliedOffset": 0,
"AppliedRowLimit": 1000,
"ReturnedRowCount": 100,
"HasMore": true,
"RecordsSizeBytes": 8192,
"QueryElapsedTimeMilliseconds": 125
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.