Domain name for API request: cls.intl.tencentcloudapi.com.
This API is used to search for content near the log context. For more details, see Context Search.The maximum value of API's return data packet is 49MB. It is recommended to enable gzip compression (HTTP Request Header Accept-Encoding: gzip).
A maximum of 20 requests can be initiated per second for this API.
This action accepts http content encodings: gzip
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| Action | Yes | String | Common Params. The value used for this API: DescribeLogContext. |
| Version | Yes | String | Common Params. The value used for this API: 2020-10-16. |
| Region | Yes | String | Common Params. For more information, please see the list of regions supported by the product. |
| TopicId | Yes | String | Log topic Id to query. -Obtain the log topic Id through Get Log Topic List. - Obtain the log topic Id through Create Log Topic. |
| BTime | Yes | String | Log time, which is the Time in the Results structure in the returned information of the retrieve and analyze logs api, should be converted from the millisecond-level Unix timestamp to a string in the YYYY-mm-dd HH:MM:SS.FFF format according to the UTC+8 time zone. |
| PkgId | Yes | String | Log package sequence number, which is the PkgId in the Results structure returned by the retrieve and analyze logs api (https://www.tencentcloud.com/document/product/614/56447?from_cn_redirect=1). |
| PkgLogId | Yes | Integer | Sequence number of a log within the log package, which is the PkgLogId in the Results structure returned by the retrieve and analyze logs api. |
| PrevLogs | No | Integer | The previous ${PrevLogs} logs. Default value: 10. |
| NextLogs | No | Integer | The next ${NextLogs} logs. Default value: 10. |
| Query | No | String | Query statement, filtering the log context with a maximum length of 12KB The statement consists of [retrieval criteria] and does not support SQL statement. |
| From | No | Integer | Context search start time, unit: millisecond-level timestamp Note: -When From is empty, it means no restrictions on the start time of context search. -From and To are not empty, From < To -Currently, the system only supports the Shanghai/Virginia/Singapore region. |
| To | No | Integer | End time of context search. Measurement unit: millisecond-level timestamp. Note: -When To is empty, it means no restrictions on the end time of context search. -From and To are not empty, From < To -Currently, the system only supports the Shanghai/Virginia/Singapore region. |
| Parameter Name | Type | Description |
|---|---|---|
| LogContextInfos | Array of LogContextInfo | Log context information set |
| PrevOver | Boolean | Whether the previous logs have been fully returned (PrevOver is false indicates that some previous logs are yet to be returned). |
| NextOver | Boolean | Whether the subsequent logs have been fully returned (NextOver is false indicates that some subsequent logs are yet to be returned). |
| RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
This example shows you how to query the context of a log.
POST / HTTP/1.1
Host: cls.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeLogContext
<Common request parameters>
{
"TopicId": "682d0718-07bb-4ec0-9fda-f1e9a2767e0b",
"BTime": "2021-04-25 14:25:00.000",
"PkgId": "528C1318606EFEB8-1A7",
"PkgLogId": 65536,
"PrevLogs": 10,
"NextLogs": 10
}
{
"Response": {
"NextOver": false,
"PrevOver": false,
"LogContextInfos": [
{
"Content": "xxxxxxx",
"HostName": "abc",
"Filename": "/usr/local/services/cls_cgi_api3-1.0/log/cls_cgi.log.20210425",
"PkgId": "528C1318606EFEB8-1A0",
"PkgLogId": 196609,
"Source": "100.105.60.255",
"BTime": 323232323
},
{
"Content": "x1x2x3",
"HostName": "abcd",
"Filename": "/usr/local/services/cls_cgi_api3-1.0/log/cls_cgi.log.20210425",
"PkgId": "528C1318606EFEB8-1A1",
"PkgLogId": 196609,
"Source": "100.105.60.255",
"BTime": 323232323
}
],
"RequestId": "b276cb6e-4687-11eb-b378-0242ac130002"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
| Error Code | Description |
|---|---|
| FailedOperation | Operation failed. |
| FailedOperation.InvalidContext | The search cursor is invalid or does not exist. |
| FailedOperation.QueryError | The query statement failed to run. |
| FailedOperation.SearchTimeout | The query timed out. |
| FailedOperation.SyntaxError | An error occurred while parsing the query statement. |
| FailedOperation.TopicIsolated | The log topic has been isolated. |
| InternalError | Internal error. |
| InternalError.SearchFailed | Retrieval failed |
| InvalidParameter | Incorrect parameter. |
| LimitExceeded.LogSearch | The number of concurrent queries exceeds the limit, which is 15 per topic. |
| LimitExceeded.SearchResultTooLarge | The number of logs returned by the search API exceeds the upper limit (20 MB). |
| MissingParameter | Missing parameter. |
| OperationDenied | Operation denied. |
| OperationDenied.AccountDestroy | The account has been terminated. |
| OperationDenied.AccountIsolate | The account has overdue payments. |
| OperationDenied.AccountNotExists | The account does not exist. |
| ResourceNotFound.TopicNotExist | The log topic does not exist. |
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan