tencent cloud

文档反馈

DescribeLogSearch

最后更新时间:2024-10-10 21:41:00

    1. API Description

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

    This API is used to search for logs.

    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 Params. The value used for this API: DescribeLogSearch.
    Version Yes String Common Params. The value used for this API: 2018-08-08.
    Region Yes String Common Params. For more information, please see the list of regions supported by the product.
    StartTime Yes Timestamp Log start time
    EndTime Yes Timestamp Log end time
    ServiceId Yes String Service ID
    Filters.N No Array of Filter Reserved field
    Limit No Integer Number of logs to be returned at a time. Maximum value: 100
    ConText No String Subsequent content can be obtained based on the ConText returned last time. Up to 10,000 data entries can be obtained
    Sort No String Sorting by time. Valid values: asc (ascending), desc (descending). Default value: desc
    Query No String Reserved field

    3. Output Parameters

    Parameter Name Type Description
    ConText String Cursor for getting more search results. If the value is "", there will be no subsequent results
    LogSet Array of String The returned result contains any number of logs, which are in the following format:
    '[$app_id][$env_name][$service_id][$http_host][$api_id][$uri][$scheme][rsp_st:$status][ups_st:$upstream_status]'
    '[cip:$remote_addr][uip:$upstream_addr][vip:$server_addr][rsp_len:$bytes_sent][req_len:$request_length]'
    '[req_t:$request_time][ups_rsp_t:$upstream_response_time][ups_conn_t:$upstream_connect_time][ups_head_t:$upstream_header_time]’
    '[err_msg:$err_msg][tcp_rtt:$tcpinfo_rtt][$pid][$time_local][req_id:$request_id]';

    Note:
    app_id: user ID.
    env_name: environment name.
    service_id: service ID.
    http_host: domain name.
    api_id: API ID.
    uri: request path.
    scheme: HTTP/HTTPS protocol.
    rsp_st: request response status code.
    ups_st: backend business server response status code (if the request is passed through to the backend, this variable will not be empty. If the request is blocked in API Gateway, this variable will be displayed as -).
    cip: client IP.
    uip: backend business service (upstream) IP.
    vip: VIP requested to be accessed.
    rsp_len: response length.
    req_len: request length.
    req_t: total request response time.
    ups_rsp_t: total backend response time (time between connection establishment by API Gateway and backend response receipt).
    ups_conn_t: time when the backend business server is successfully connected to.
    ups_head_t: time when the backend response header arrives.
    err_msg: error message.
    tcp_rtt: client TCP connection information. RTT (Round Trip Time) consists of three parts: link propagation delay, end system processing delay, and queuing delay in router cache.
    req_id: request ID.
    TotalCount Integer Number of logs returned for one search (TotalCount <= Limit)
    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.

    4. Example

    Example1 Indicating request failure

    This example shows you how to figure out what happens when parameters are invalid.

    Input Example

    https://apigateway.tencentcloudapi.com/?Action=DescribeLogSearch
    &StartTime=2019-10-10 00:00:00
    &EndTime=2019-10-10 23:59:59
    &ServiceId=service-8xipv0ua
    &Limit=101
    &<Common Request Parameters>
    

    Output Example

    {
        "Response": {
            "ConText": "Y29udGV4dC0xOTE1NTdiOS04YjVhLTRkZWQtODA5YS0zOTg2MmY0ZjdkN2MxNTkwNjc3NzU5NTcy",
            "TotalCount": 20,
            "LogSet": [
                "[1300127097][release][service-8xipv0ua][service-8xipv0ua-1300127097.gz.apigw.tencentcs.com][api-55rj9ide][/][http][rsp_st:200][ups_st:-][cip:119.123.71.59][uip:-][vip:193.112.148.212][rsp_len:328][req_len:114][req_t:0.000][ups_rsp_t:-][ups_conn_t:-][ups_head_t:-][err_msg:-][tcp_rtt:12500][20260][28/May/2020:22:42:42 +0800][req_id:a26f8eaf6ef7e4ef466a25036332139a]",
                "[1300127097][release][service-8xipv0ua][service-8xipv0ua-1300127097.gz.apigw.tencentcs.com][api-55rj9ide][/][http][rsp_st:200][ups_st:-][cip:119.123.71.59][uip:-][vip:193.112.148.212][rsp_len:328][req_len:114][req_t:0.000][ups_rsp_t:-][ups_conn_t:-][ups_head_t:-][err_msg:-][tcp_rtt:13500][20247][28/May/2020:22:42:41 +0800][req_id:53500963839556bc40ae185c2a135353]",
                "[1300127097][release][service-8xipv0ua][service-8xipv0ua-1300127097.gz.apigw.tencentcs.com][api-55rj9ide][/][http][rsp_st:200][ups_st:-][cip:119.123.71.59][uip:-][vip:193.112.148.212][rsp_len:328][req_len:114][req_t:0.000][ups_rsp_t:-][ups_conn_t:-][ups_head_t:-][err_msg:-][tcp_rtt:12500][20244][28/May/2020:22:42:41 +0800][req_id:e4a934687379333230168e4674655b00]",
                "[1300127097][release][service-8xipv0ua][service-8xipv0ua-1300127097.gz.apigw.tencentcs.com][api-55rj9ide][/][http][rsp_st:200][ups_st:-][cip:119.123.71.59][uip:-][vip:193.112.148.212][rsp_len:328][req_len:114][req_t:0.000][ups_rsp_t:-][ups_conn_t:-][ups_head_t:-][err_msg:-][tcp_rtt:12500][20261][28/May/2020:22:42:41 +0800][req_id:74ddc940596054cd16fc7b2ccfa6b36d]",
                "[1300127097][release][service-8xipv0ua][service-8xipv0ua-1300127097.gz.apigw.tencentcs.com][api-55rj9ide][/][http][rsp_st:200][ups_st:-][cip:119.123.71.59][uip:-][vip:193.112.148.212][rsp_len:328][req_len:114][req_t:0.000][ups_rsp_t:-][ups_conn_t:-][ups_head_t:-][err_msg:-][tcp_rtt:14000][20240][28/May/2020:22:42:40 +0800][req_id:ad1f06dd126d10930dbed41c2dbcd90a]",
                "[1300127097][release][service-8xipv0ua][service-8xipv0ua-1300127097.gz.apigw.tencentcs.com][api-55rj9ide][/][http][rsp_st:200][ups_st:-][cip:119.123.71.59][uip:-][vip:193.112.148.212][rsp_len:328][req_len:114][req_t:0.000][ups_rsp_t:-][ups_conn_t:-][ups_head_t:-][err_msg:-][tcp_rtt:14500][20253][28/May/2020:22:42:40 +0800][req_id:56865fe7631a4ca9efaaeeeebe739707]",
                "[1300127097][release][service-8xipv0ua][service-8xipv0ua-1300127097.gz.apigw.tencentcs.com][api-55rj9ide][/][http][rsp_st:200][ups_st:-][cip:119.123.71.59][uip:-][vip:193.112.148.212][rsp_len:328][req_len:114][req_t:0.000][ups_rsp_t:-][ups_conn_t:-][ups_head_t:-][err_msg:-][tcp_rtt:14000][20249][28/May/2020:22:42:39 +0800][req_id:51a305fc4f84248695b0313f58002e54]",
                "[1300127097][release][service-8xipv0ua][service-8xipv0ua-1300127097.gz.apigw.tencentcs.com][api-55rj9ide][/][http][rsp_st:200][ups_st:-][cip:119.123.71.59][uip:-][vip:193.112.148.212][rsp_len:328][req_len:114][req_t:0.000][ups_rsp_t:-][ups_conn_t:-][ups_head_t:-][err_msg:-][tcp_rtt:15500][20273][28/May/2020:22:42:39 +0800][req_id:81cc0eb9d1cabe580c0f91e4cd514b6a]",
                "[1300127097][release][service-8xipv0ua][service-8xipv0ua-1300127097.gz.apigw.tencentcs.com][api-55rj9ide][/][http][rsp_st:200][ups_st:-][cip:119.123.71.59][uip:-][vip:193.112.148.212][rsp_len:328][req_len:114][req_t:0.000][ups_rsp_t:-][ups_conn_t:-][ups_head_t:-][err_msg:-][tcp_rtt:16000][20254][28/May/2020:22:42:38 +0800][req_id:138467bbff388882dadf7d101ff321e0]",
                "[1300127097][release][service-8xipv0ua][service-8xipv0ua-1300127097.gz.apigw.tencentcs.com][api-55rj9ide][/][http][rsp_st:200][ups_st:-][cip:119.123.71.59][uip:-][vip:193.112.148.212][rsp_len:328][req_len:114][req_t:0.000][ups_rsp_t:-][ups_conn_t:-][ups_head_t:-][err_msg:-][tcp_rtt:14500][20236][28/May/2020:22:42:38 +0800][req_id:bd80236f63a0cc276b3e37596aadd41b]",
                "[1300127097][release][service-8xipv0ua][service-8xipv0ua-1300127097.gz.apigw.tencentcs.com][api-55rj9ide][/][http][rsp_st:200][ups_st:-][cip:119.123.71.59][uip:-][vip:193.112.148.212][rsp_len:328][req_len:114][req_t:0.000][ups_rsp_t:-][ups_conn_t:-][ups_head_t:-][err_msg:-][tcp_rtt:11500][20259][28/May/2020:22:42:37 +0800][req_id:a9f65829cf6e6b89f1ac1667eb1f7917]",
                "[1300127097][release][service-8xipv0ua][service-8xipv0ua-1300127097.gz.apigw.tencentcs.com][api-55rj9ide][/][http][rsp_st:200][ups_st:-][cip:119.123.71.59][uip:-][vip:193.112.148.212][rsp_len:328][req_len:114][req_t:0.000][ups_rsp_t:-][ups_conn_t:-][ups_head_t:-][err_msg:-][tcp_rtt:11500][20246][28/May/2020:22:42:37 +0800][req_id:946d51c39f23bdc99f1949420aab32cb]",
                "[1300127097][release][service-8xipv0ua][service-8xipv0ua-1300127097.gz.apigw.tencentcs.com][api-55rj9ide][/][http][rsp_st:200][ups_st:-][cip:119.123.71.59][uip:-][vip:193.112.148.212][rsp_len:328][req_len:114][req_t:0.000][ups_rsp_t:-][ups_conn_t:-][ups_head_t:-][err_msg:-][tcp_rtt:11500][20252][28/May/2020:22:42:36 +0800][req_id:e762ac1b039098de1d140b4369c3e478]",
                "[1300127097][release][service-8xipv0ua][service-8xipv0ua-1300127097.gz.apigw.tencentcs.com][api-55rj9ide][/][http][rsp_st:200][ups_st:-][cip:119.123.71.59][uip:-][vip:193.112.148.212][rsp_len:328][req_len:114][req_t:0.000][ups_rsp_t:-][ups_conn_t:-][ups_head_t:-][err_msg:-][tcp_rtt:11500][20235][28/May/2020:22:42:36 +0800][req_id:0b353eac83a78dbdaa6366f5ec5dedfc]",
                "[1300127097][release][service-8xipv0ua][service-8xipv0ua-1300127097.gz.apigw.tencentcs.com][api-55rj9ide][/][http][rsp_st:200][ups_st:-][cip:119.123.71.59][uip:-][vip:193.112.148.212][rsp_len:328][req_len:114][req_t:0.000][ups_rsp_t:-][ups_conn_t:-][ups_head_t:-][err_msg:-][tcp_rtt:12500][20247][28/May/2020:22:42:35 +0800][req_id:55371f19fb83913ff86755c2ae52362c]",
                "[1300127097][release][service-8xipv0ua][service-8xipv0ua-1300127097.gz.apigw.tencentcs.com][api-55rj9ide][/][http][rsp_st:200][ups_st:-][cip:119.123.71.59][uip:-][vip:193.112.148.212][rsp_len:328][req_len:114][req_t:0.000][ups_rsp_t:-][ups_conn_t:-][ups_head_t:-][err_msg:-][tcp_rtt:12000][20268][28/May/2020:22:42:35 +0800][req_id:32ab8e63e7dfaa8b553ba58085fd754c]",
                "[1300127097][release][service-8xipv0ua][service-8xipv0ua-1300127097.gz.apigw.tencentcs.com][api-55rj9ide][/][http][rsp_st:200][ups_st:-][cip:119.123.71.59][uip:-][vip:193.112.148.212][rsp_len:328][req_len:114][req_t:0.000][ups_rsp_t:-][ups_conn_t:-][ups_head_t:-][err_msg:-][tcp_rtt:12500][20232][28/May/2020:22:42:34 +0800][req_id:21c6c7c1e21bc7e39c290bf3d56bd3ba]",
                "[1300127097][release][service-8xipv0ua][service-8xipv0ua-1300127097.gz.apigw.tencentcs.com][api-55rj9ide][/][http][rsp_st:200][ups_st:-][cip:119.123.71.59][uip:-][vip:193.112.148.212][rsp_len:328][req_len:114][req_t:0.000][ups_rsp_t:-][ups_conn_t:-][ups_head_t:-][err_msg:-][tcp_rtt:12000][20263][28/May/2020:22:42:33 +0800][req_id:3970867bbb023265a03b86d49ef52b59]",
                "[1300127097][release][service-8xipv0ua][service-8xipv0ua-1300127097.gz.apigw.tencentcs.com][api-55rj9ide][/][http][rsp_st:200][ups_st:-][cip:119.123.71.59][uip:-][vip:193.112.148.212][rsp_len:328][req_len:114][req_t:0.000][ups_rsp_t:-][ups_conn_t:-][ups_head_t:-][err_msg:-][tcp_rtt:12000][20255][28/May/2020:22:42:33 +0800][req_id:caaa1b83b0bcd7a5b1325281769b9364]",
                "[1300127097][release][service-8xipv0ua][service-8xipv0ua-1300127097.gz.apigw.tencentcs.com][api-55rj9ide][/][http][rsp_st:200][ups_st:-][cip:119.123.71.59][uip:-][vip:193.112.148.212][rsp_len:328][req_len:114][req_t:0.000][ups_rsp_t:-][ups_conn_t:-][ups_head_t:-][err_msg:-][tcp_rtt:8500][20246][28/May/2020:22:42:32 +0800][req_id:64866292cce1f59504e4ae30796d3731]"
            ],
            "RequestId": "239c9af4-2e79-4252-b5e5-c7a4c0c7f743"
        }
    }
    

    Example2 Indicating Filters parameter examples

    This example shows you how to view LogQuerys that indicates the log search criteria.Including: LogQuerys.0.Name=api_id&LogQuerys.0.Operator==&LogQuerys.0.Value=api-55rj9ide
    indicates to search for logs of api_id=api-55rj9ide.

    Input Example

    https://apigateway.tencentcloudapi.com/?Action=DescribeLogSearch
    &StartTime=2020-05-28 22:00:00
    &EndTime=2020-05-28 23:00:00
    &ServiceId=service-8xipv0ua
    &LogQuerys.0.Name=api_id
    &LogQuerys.0.Operator==
    &LogQuerys.0.Value=api-55rj9ide
    &<Common Request Parameters>
    

    Output Example

    {
        "Response": {
            "RequestId": "5a8b1de4-04f5-48eb-9be6-93491ebee6e1"
        }
    }
    

    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
    InternalError.OssException OSS internal request error. Please try again. If the problem persists, please contact the smart customer service or submit a ticket.
    InvalidParameterValue.InvalidRegion Incorrect region.
    ResourceNotFound.InvalidService The corresponding service is invisible.
    UnsupportedOperation.ClsSearchTime Invalid log query period
    UnsupportedOperation.InvalidAction API error.