DescribeLogContext

Last updated: 2021-11-30 16:26:23

1. API Description

Domain name for API request: cls.tencentcloudapi.com.

This API is used to search for content in the log context.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

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 parameter. The value used for this API: DescribeLogContext.
Version Yes String Common parameter. The value used for this API: 2020-10-16.
Region Yes String Common parameter. For more information, please see the list of regions supported by the product.
TopicId Yes String Log topic ID to be queried
BTime Yes String Log time in the format of YYYY-mm-dd HH:MM:SS
PkgId Yes String Log package number
PkgLogId Yes Integer Log number in log package
PrevLogs No Integer Number of previous logs. Default value: 10
NextLogs No Integer Number of next logs. Default value: 10

3. Output Parameters

Parameter Name Type Description
LogContextInfos Array of LogContextInfo Log context information set
PrevOver Boolean Whether the previous logs have been returned
NextOver Boolean Whether the next logs have been returned
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Searching in context

Input Example

POST / HTTP/1.1
Host: cls.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
}

Output Example

{
  "Response": {
    "NextOver": false,
    "PrevOver": false,
    "LogContextInfos": [
      {
        "Content": "xxxxxxx",
        "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",
        "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"
  }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

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.
InvalidParameter Incorrect parameter.
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.