tencent cloud

APIs

DescribeLogAnalysisStatistics

Download
Focus Mode
Font Size
Last updated: 2026-11-25 16:58:43

1. API Description

Domain name for API request: teo.intl.tencentcloudapi.com.

This API is used to query log analysis statistics results. Users append an SQL aggregation statement after the query statement ([retrieval condition] | [SQL statement]). The backend executes the aggregation and returns columnar statistics results (column definition + data row).

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: DescribeLogAnalysisStatistics.
Version Yes String Common Params. The value used for this API: 2022-09-01.
Region No String Common Params. This parameter is not required.
ZoneId Yes String

Site ID.

Area Yes String

Data ownership region. Available values:

  • mainland: within the Chinese mainland;
  • overseas: global (excluding the Chinese mainland).
Note: If the site service area is "global availability zone", to obtain all data, query the data of mainland and overseas separately.

LogType Yes String

Log type. Available values:

  • l7-access-logs: L7 access log;
  • web-attack: managed rule log.
Default value: l7-access-logs.

StartTime Yes Timestamp ISO8601

Start time. Example value: 2020-04-29T00:00:00Z. The maximum span from the query start time to this day varies by package version. For details, see Package Selection Comparison.

EndTime Yes Timestamp ISO8601

End time, for example, 2020-04-30T00:00:00Z. The maximum time span from start time to end time per request is 31 days.

Query Yes String

Statistical query statement, composed of [retrieval criteria] | [SQL statement]. The SQL segment after the pipe character "|" is required. The retrieval criteria segment can be empty (for example, | SELECT ...), which means aggregation on full data. Maximum length: 12 KB. Default SQL Limit: 100. Maximum Limit: 10000.
Example:

With retrieval criteria: ${EdgeCacheStatus} in ['miss','other'] | select EdgeCacheStatus as status, count() as cnt group by status limit 2

Without retrieval criteria: | select EdgeCacheStatus as status, count() as cnt group by status

3. Output Parameters

Parameter Name Type Description
Columns Array of String

Column names in the log analysis statistical result, corresponding to the fields in the SELECT part of the SQL in the input parameter Query.
Example:
Input parameter Query = ${EdgeCacheStatus} in ['miss','other'] | SELECT EdgeCacheStatus as status, count(*) as cnt group by status limit 2
Output parameter Columns = ["status","cnt"]

Records Array of StatisticsRecord

Rows of data in the log analysis statistics result. The value index in each row corresponds one-to-one with the column index.
Example:
Columns = ["status","cnt"]
Records = [["miss","9695"],["other","278"]]

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 Query log analytics statistical results grouped by cache status for a specified site within a time range

This example shows you how to query the statistical results of Layer 7 Access Logs for a query site (ZoneId = zone-3qcox8or8ccl) on the Chinese mainland from 2026-07-14T00:00:00Z to 2026-07-18T00:00:00Z. The statistical statement is: select EdgeCacheStatus as status, count(*) as cnt group by status limit 2, and the filter condition is cache status = cache miss or other.

Input Example

POST / HTTP/1.1
Host: teo.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeLogAnalysisStatistics
<Common request parameters>

{
    "ZoneId": "zone-3qcox8or8ccl",
    "Area": "mainland",
    "LogType": "l7-access-logs",
    "StartTime": "2026-07-14T00:00:00Z",
    "EndTime": "2026-07-18T00:00:00Z",
    "Query": "${EdgeCacheStatus} in ['miss','other'] | select EdgeCacheStatus as status, count(*) as cnt group by status limit 2"
}

Output Example

{
    "Response": {
        "Columns": [
            "status"
        ],
        "Records": [
            {
                "Record": [
                    "miss"
                ]
            }
        ],
        "RequestId": "6d5d22a3-7977-4fb9-b649-c796fd9cf358"
    }
}

Example2 Query total number of logs for log analysis for a specified site within a time range

This example shows you how to query the statistical results of Layer 7 Access Logs for the Chinese mainland at the query site (ZoneId = zone-3qcox8or8ccl) from 2026-07-14T00:00:00Z to 2026-07-18T00:00:00Z. The statistical statement is: select count(*) as cnt, with no filter conditions.

Input Example

POST / HTTP/1.1
Host: teo.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeLogAnalysisStatistics
<Common request parameters>

{
    "ZoneId": "zone-3qcox8or8ccl",
    "Area": "mainland",
    "LogType": "l7-access-logs",
    "StartTime": "2026-07-14T00:00:00Z",
    "EndTime": "2026-07-18T00:00:00Z",
    "Query": "* | select count(*) as cnt"
}

Output Example

{
    "Response": {
        "Columns": [
            "cnt"
        ],
        "Records": [
            {
                "Record": [
                    "5"
                ]
            }
        ],
        "RequestId": "d3c0b5e3-b3fa-433e-97e5-9274c5d3167f"
    }
}

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

There is no error code related to the API business logic. For other error codes, please see Common Error Codes.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback