AI Agent Hub
Back to skills
Tencent Cloud CLS Assistant icon

Tencent Cloud CLS Assistant

IT Ops & Security Updated 2026.08.29

Paste the following prompt into your AI chat to install this skill:

Please follow https://skillhub.cn/install/skillhub.md to install @tencent-adm/tencentcloud-cls.

About this skill

Problem

When debugging Tencent Cloud CLS, the issue is rarely just missing logs. It may be a wrong topic ID, an unrebuilt index, an offline machine, a collection rule not bound to the right machine group, an alarm shield, or a bad PromQL query. Manual API calls are easy to get wrong: SearchLog uses millisecond timestamps while QueryRangeMetric uses second-level timestamps, and SQL analysis cannot rely on Limit or Offset. This skill turns those checks into an API workflow around scripts/cls_api.py.

How It Works

  • Log path: use DescribeTopics to find the topic, SearchLog for CQL/SQL search, DescribeLogContext for surrounding logs, and DescribeLogHistogram for time distribution.
  • Collection path: use DescribeMachineGroups, DescribeMachines, DescribeConfigs, and DescribeConfigMachineGroups to verify machines, collection rules, and bindings.
  • Metrics and alarms: use QueryRangeMetric for PromQL, and DescribeAlarms, DescribeAlertRecordHistory, GetAlarmLog, and DescribeAlarmShields to trace missing or false alarms.

Boundaries

  • Credentials must come from environment variables; do not embed TENCENTCLOUD_SECRET_ID or TENCENTCLOUD_SECRET_KEY in commands.
  • Time precision varies: most log APIs use milliseconds, most metric APIs use seconds, and DescribeLogContext.BTime uses YYYY-mm-dd HH:MM:SS.FFF.
  • DescribeLogContext has regional limitations; in unsupported regions, simulate context with SearchLog over a time range.

Use Cases

  • When production errors appear, search a CLS topic by time range with CQL and aggregate error codes.
  • When log collection is missing, check machine groups, machine status, collection rules, and bindings.
  • When an alarm did not fire, inspect policies, history, execution logs, and shield rules to find the gap.
  • When checking host or cluster metrics, run PromQL range queries and verify topic, labels, and configs.

Best For

  • SREs handling production incidents: search logs with CQL/SQL and inspect context and trends.
  • Ops engineers maintaining log collection: verify machine groups, machine status, rules, and bindings.
  • Platform engineers managing alerts: trace policies, history, execution details, and shields.
  • Backend engineers using CLS metrics: query PromQL and verify labels and collection configs.