Get Log Index Tags Information¶
GET /api/v1/metric_info/log/tags
Overview¶
Sample and retrieve the values of a specified field in a log index.
Before Calling and Usage Steps¶
The query range is the current day in the workspace time zone. If no data meets the conditions, the result field is the corresponding empty array. It returns some non-null values and cannot be used to enumerate all historical values. null, empty strings, 0, and false in upstream query results are not included in the sample list. If the index name or field name is left empty, the request returns success and content is {}.
Request Headers¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | AK identifier used for authentication Example: <DF-API-KEY>How to obtain or specify: Create or obtain a Key with permissions for this API in API Key Management in the target workspace. |
Query Request Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| index | string | Y | Log index name; use the original value in the response. Allow null: False Example: defaultHow to obtain or specify: Obtain the value from content.data[].name in the response of Get Log Index List. |
| tag | string | Y | Field name in the log index, for example, service. Allow null: False Example: serviceHow to obtain or specify: Select from content.fields[].name in the response of Get Log Schema. |
| limit | integer | Defaults to 10; values greater than 10 are treated as 10. Please pass a positive integer. Allow null: True Default value: 10 Example: 10How to obtain or specify: Set according to the number of samples required by the caller; 1 to 10 is recommended. |
Additional Parameter Notes¶
Use GET to read data in the workspace to which the current API Key belongs.
Example Request¶
curl --get -H "DF-API-KEY: <DF-API-KEY>" \
"https://openapi.guance.com/api/v1/metric_info/log/tags" \
--data-urlencode "index=default" \
--data-urlencode "tag=service" \
--data-urlencode "limit=10"
Response¶
HTTP 200, application/json.
| Field | Type | Description |
|---|---|---|
| content.index | string | The log index in the request. |
| content.tag | string | The field or Tag name in the request. |
| content.values | array | Sampled values. The element type depends on the data source field; when no values match, it is an empty array. |
| content.declaration | object or null | The workspace common declaration attached to non-empty content; when not configured, it may be null or an empty object; it is not added for an empty content object. |
{
"code": 200,
"content": {
"index": "default",
"tag": "service",
"values": [
"api",
"worker"
],
"declaration": null
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Responses¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | Missing required Query parameters, or undeclared Query parameters were passed | Request field validation failed; the message indicates the field or rule. | Check the parameter table and examples. |
| 403 | ft.ForbiddenQuery | The current credential is not authorized to query the data corresponding to the request | Insufficient query permissions. | Check the API Key query permissions and the authorization scope of the target data. |
| 503 | ft.QueryServiceUnavailable | The dependent query service is temporarily unavailable | The query service is temporarily unavailable; try again later. | Check content.retryable; transient errors can be retried after a delay. |
| 500 | ft.InternalServerError | A string that cannot be converted to an integer is passed for limit | Internal error. | Check the pagination field used against the parameter table, pass a decimal integer string, and retry. |