cls_get_log_count
Retrieve the total count of logs matching specific criteria in Tencent Cloud Log Service using CQL queries, providing faster results than full log searches for statistical analysis.
Instructions
快速获取日志数量。相比 cls_search_log 更快,适合只需要知道日志总数的场景。
参数说明
topic_id: 日志主题 ID(必填)。格式不固定,可能是 UUID(如
550b584b-xxxx)或自定义字符串。当用户提供的值不确定是 ID 还是名称时,优先当作 topic_id 直接使用;如果报错(如"主题不存在"),再通过 cls_describe_topics 按名称搜索获取正确的 topic_idquery: CQL 检索语句(必填)
start_time: 起始时间,Unix 时间戳(毫秒)
end_time: 结束时间,Unix 时间戳(毫秒)
region: 地域(可选),如 ap-guangzhou、na-ashburn,不传则使用默认地域,可通过 cls_describe_regions 查询所有可用地域
适用场景
快速确认某类日志是否存在
统计特定时间范围内的日志总量
注意事项
⏰ start_time/end_time 为毫秒时间戳,请先调用 cls_convert_time 工具转换,不要手动计算
💡 编写 SQL 分析语句前,建议先调用 cls_describe_index 获取目标主题的索引配置,确认字段名称、类型及是否开启统计,避免因字段信息不明确导致查询失败
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topic_id | Yes | ||
| query | Yes | ||
| start_time | Yes | ||
| end_time | Yes | ||
| region | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |