cls_get_log_histogram
Analyze log volume trends over time by generating histograms to detect anomalies and monitor distribution patterns in Tencent Cloud Log Service.
Instructions
获取日志数量直方图。统计指定时间范围内日志在时间维度上的分布情况,用于观察日志量趋势和异常波动。
参数说明
topic_id: 日志主题 ID(必填)
query: CQL 检索语句(必填),如
level:ERROR或*(全部日志)start_time: 起始时间,Unix 时间戳(毫秒)
end_time: 结束时间,Unix 时间戳(毫秒)
interval: 时间间隔(毫秒),系统会自动选择合适间隔,也可手动指定
适用场景
观察日志量随时间的变化趋势
发现某个时间段的日志突增或突降
结合 cls_search_log 定位具体异常时段
注意事项
⏰ start_time/end_time 为毫秒时间戳,请先调用 cls_convert_time 工具转换,不要手动计算
💡 编写 SQL 分析语句前,建议先调用 cls_describe_index 获取目标主题的索引配置,确认字段名称、类型及是否开启统计,避免因字段信息不明确导致查询失败
region: 地域(可选),如 ap-guangzhou、na-ashburn,不传则使用默认地域,可通过 cls_describe_regions 查询所有可用地域
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topic_id | Yes | ||
| query | Yes | ||
| start_time | Yes | ||
| end_time | Yes | ||
| interval | No | ||
| region | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |