機能の概要
SQL監査データを照会するために使用されます。
呼び出しの説明
インターフェース制約
呼び出し元はマルチクラウドAPIにアクセスするためのキーを保有している必要があります。AccessKey IDとAccessKey Secretの取得方法の詳細については、アクセスキーの管理をご参照ください。
リクエストパス
GET /api/v2/instances/{instanceId}/tenants/{tenantId}/sqlaudit/data
リクエストパラメータ
Path
パラメータ名 |
型 |
必須 |
説明 |
サンプル値 |
|---|---|---|---|---|
| instanceId | String | はい | クラスタID | ob317v4uif**** |
| tenantId | String | はい | テナントID | t4louaeei**** |
Query
パラメータ名 |
型 |
必須 |
説明 |
サンプル値 |
|---|---|---|---|---|
| startTime | String | はい | 区間開始時間 | 2025-01-01T00:00:00Z |
| endTime | String | はい | 区間終了時間 | 2025-01-02T00:00:00Z |
| clientIp | String | いいえ | クライアントIPリスト | xx.xxx.xx.xxx |
| dbName | String | いいえ | データベースリスト | default_database |
| executeTimeMin | Integer | いいえ | 最小実行時間、ミリ秒単位 | 10 |
| executeTimeMax | Integer | いいえ | 最大実行時間、ミリ秒単位 | 1000 |
| nodeIp | String | いいえ | 実行ノードリスト | i-bp18l4****str4uk03 |
| operatorType | String | いいえ | SQLタイプ、例:SELECT、CREATEなど | SELECT |
| scanRowsMin | Integer | いいえ | スキャン最小行数 | 0 |
| scanRowsMax | Integer | いいえ | スキャン最大行数 | 10000 |
| userName | String | いいえ | ユーザー名リスト | doc_test |
| searchKeyWord | String | いいえ | クエリキーワード | update |
| searchKeyWordMethod | String | いいえ | クエリの関係。選択可能な値:and、or | and |
| sortField | String | いいえ | ソートフィールド | elapsedTime |
| sortType | String | いいえ | ソートタイプ | desc |
| pageNumber | Integer | いいえ | ページ番号。デフォルトは1 | 1 |
| pageSize | Integer | いいえ | 1ページあたりの件数。デフォルトは10 | 10 |
| openRequest | unknown | はい | Open requestパラメータ | - |
戻り値
パラメータ名 |
型 |
説明 |
サンプル値 |
|---|---|---|---|
| data | Object | SQL監査データ | - |
| sqlAuditDTOList | Array | SQL監査リスト | - |
| affectedRows | Integer | 影響行数 | 0 |
| clientIp | String | クライアントIP | xx.xxx.xx.xxx |
| databaseName | String | データベース名 | default_database |
| elapsedTime | Float | 実行時間 | 19.0 |
| isSuccess | Boolean | 成否 | true |
| operatorType | String | 操作タイプ | SELECT |
| querySQL | String | SQL文 | SELECT table_schema as schema_name, 'VIEW' as type, table_name as name FROM information_schema.tables where table_type = 'VIEW' ORDER BY schema_name, name |
| requestTime | String | リクエスト時間 | 2025-03-20T08:43:41Z |
| retCode | Integer | 戻りコード | 0 |
| scanRows | Integer | スキャン行数 | 3519 |
| sqlID | String | SQL ID | D56D688E7D666115D0A88A3B182242C8 |
| userClientIp | String | ユーザークライアントIP | xx.xxx.xx.xxx |
| userName | String | ユーザー名 | doc_test |
| requestId | String | リクエストID | xxxxxx |
| success | Boolean | リクエストの成否 | true |
例
リクエスト例
curl --digest -u '<Your AK:SK>' \
-X GET \
'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants/{tenantId}/sqlaudit/data?openRequest={openRequest}' \
-G \
-d 'startTime={startTime}' \
-d 'endTime={endTime}' \
-d 'pageNumber={pageNumber}' \
-d 'pageSize={pageSize}'
レスポンス例
JSON形式
{
"data": {
"sqlAuditDTOList": [
{
"affectedRows": 0,
"clientIp": "xx.xxx.xx.xxx",
"databaseName": "default_database",
"elapsedTime": 19.0,
"isSuccess": 1,
"key": 1,
"operatorType": "SELECT",
"querySQL": "SELECT table_schema as schema_name, 'VIEW' as type, table_name as name FROM information_schema.tables where table_type = 'VIEW' ORDER BY schema_name, name",
"requestTime": "2025-03-20T08:43:41Z",
"requestTimestamp": 0,
"retCode": 0,
"scanRows": 3519,
"sqlID": "D56D688E7D666115D0A88A3B********",
"userClientIp": "xx.xxx.xx.xxx",
"userName": "doc_test"
}
]
},
"requestId": "xxxxxx",
"success": true
}