ストリームクエリ一覧取得
ストリームクエリの一覧を取得します。本操作には管理者権限が必要です。
必要な権限
ADMIN以上のロールが必要です。
HTTPリクエスト
GET /api/sonar/stream-queries
cURL例
curl -H "Authorization: Bearer <API_KEY>" \
"https://HOSTNAME/api/sonar/stream-queries?offset=0&limit=20"
リクエストパラメータ
| キー | 必須 | 型 | 説明 | 備考 |
|---|---|---|---|---|
| offset | ○ | 32ビット整数 | スキップ件数 | 0以上の整数 |
| limit | ○ | 32ビット整数 | 最大件数 | 0以上の整数 |
| keywords | × | 文字列 | 検索キーワード | name、description、queryで検索する文字列 |
正常応答
{
"total_count": 2,
"stream_queries": [
{
"guid": "6dc1c563-d01c-3047-9573-cc6c24374925",
"name": "example-code-1108",
"description": "ストリームクエリ例",
"source_type": "table",
"sources": ["TABLE1", "TABLE2"],
"interval": 60,
"query_string": "rename RESULT_CODE as RESULT_CODE | eval bucket = string(LOG_TIME, \"yyyyMMddHHmm\") | stats count by bucket,_host,RESULT_CODE,SVC_NAME,TO_SVC_NAME,CALLING_INTERFACE | rename SVC_NAME as group_field1 | rename TO_SVC_NAME as group_field2 | rename CALLING_INTERFACE as group_field3 | eval _time=date(bucket,\"yyyyMMddHHmm\") | fields _time,bucket,_host,group_field1,group_field2,group_field3,RESULT_CODE,count | import example-code-1108",
"is_enabled": true,
"is_async": false
},
{
"guid": "3fbedcfa-70f4-354e-a22c-d82007004657",
"name": "example-code-1111",
"description": "ストリームクエリ例",
"source_type": "table",
"sources": ["TABLE1"],
"interval": 60,
"query_string": "rename RESULT_CODE as RESULT_CODE | eval bucket = string(LOG_TIME, \"yyyyMMddHHmm\") | stats count by bucket,_host,RESULT_CODE,TO_SVC_NAME,CALLING_CONTENTS,CEK_EXTENSION_ID | rename TO_SVC_NAME as group_field1 | rename CALLING_CONTENTS as group_field2 | rename CEK_EXTENSION_ID as group_field3 | eval _time=date(bucket,\"yyyyMMddHHmm\") | fields _time,bucket,_host,group_field1,group_field2,group_field3,RESULT_CODE,count | import example-code-1111",
"is_enabled": true,
"is_async": false
}
]
}
- total_count(32ビット整数):全ストリームクエリ数
- stream_queries(配列):ページングされたストリームクエリ一覧
- guid(文字列):ストリームクエリGUID
- name(文字列):名称
- description(文字列):説明
- source_type(文字列):ソースタイプ(
table、logger、streamのいずれか) - sources(配列):ソースリスト
- interval(32ビット整数):リフレッシュインターバル(秒)
- query_string(文字列):クエリ文
- is_enabled(ブール値):アクティブ状態
- is_async(ブール値):非同期モードかどうか
エラー応答
必須パラメータが不足している場合
HTTPステータスコード 400 応答
{
"error_code": "null-argument",
"error_msg": "offset should be not null"
}
offset、limitの値が整数でない場合
HTTPステータスコード 400 応答
{
"error_code": "invalid-argument",
"error_msg": "'offset' parameter should be int type"
}
offset、limitの値が負の値の場合
HTTPステータスコード 400 応答
{
"error_code": "invalid-argument",
"error_msg": "'offset' must be greater than or equal to 0."
}
ストリームクエリ一覧取得権限がない場合
HTTPステータスコード 500 応答
{
"error_code": "illegal-state",
"error_msg": "no-permission"
}