Query and analyze Tencent Cloud CLS logs
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install clscli或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install clscli⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/clscli/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: clscli description: Query and analyze Tencent Cloud CLS logs homepage: https://github.com/ metadata: {"requires": {"bin": ["clscli"], "env": ["TENCENTCLOUD_SECRET_ID", "TENCENTCLOUD_SECRET_KEY"]}} ---
Query and analyze Tencent Cloud CLS logs.
```bash brew tap dbwang0130/clscli brew install dbwang0130/clscli/clscli ```
```bash export TENCENTCLOUD_SECRET_ID="your-secret-id" export TENCENTCLOUD_SECRET_KEY="your-secret-key" ```
--region (e.g. ap-guangzhou).!IMPORTANT: If you do not know the log topic, list topics first.
List topics in a region to determine which --region and topic ID to use for query/context.
clscli topics --region <region> [--topic-name name] [--logset-name name] [--logset-id id] [--limit 20] [--offset 0]
Examples: --output=json, --output=csv, -o topics.csv
| Option | Required | Description | |--------|----------|-------------| | --region | yes | CLS region, e.g. ap-guangzhou | | --topic-name | no | Filter by topic name (fuzzy match) | | --logset-name | no | Filter by logset name (fuzzy match) | | --logset-id | no | Filter by logset ID | | --limit | no | Page size, default 20, max 100 | | --offset | no | Pagination offset, default 0 | | --output, -o | no | Output: json, csv, or file path |
Output columns: Region, TopicId, TopicName, LogsetId, CreateTime, StorageType.
clscli query -q "[query condition] | [SQL statement]" --region <region> -t <TopicId> --last 1h
Examples:
--last 1h, --last 30m; or --from/--to (Unix ms)--topics , or multiple -t --max 5000 (paginate until 5000 logs or ListOver)--output=json, --output=csv, -o result.json (write to file)| Option | Required | Description | |--------|----------|-------------| | --region | yes | CLS region, e.g. ap-guangzhou | | -q, --query | yes | Query condition or SQL, e.g. level:ERROR or \| select count() as cnt | | -t, --topic | one of -t/--topics | Single log topic ID | | --topics | one of -t/--topics | Comma-separated topic IDs, max 50 | | --last | one of --last/--from/--to | Time range, e.g. 1h, 30m, 24h | | --from, --to | one of --last/--from/--to | Start/end time (Unix ms) | | --limit | no | Logs per request, default 100, max 1000 | | --max | no | Max total logs; when non-zero, auto-paginate until reached or ListOver | | --output, -o | no | Output: json, csv, or file path | | --sort | no | Sort: asc or desc, default desc |
Two syntaxes are supported:
| Syntax | Description | |--------|-------------| | key:value | Key-value search; logs where field (key) contains value, e.g. level:ERROR | | value | Full-text search; logs containing value, e.g. ERROR | | AND | Logical AND, case-insensitive, e.g. level:ERROR AND pid:1234 | | OR | Logical OR, case-insensitive, e.g. level:ERROR OR level:WARNING, level:(ERROR OR WARNING) | | NOT | Logical NOT, case-insensitive, e.g. level:ERROR NOT pid:1234, level:ERROR AND NOT pid:1234 | | () | Grouping for precedence, e.g. level:(ERROR OR WARNING) AND pid:1234. Note: AND has higher precedence than OR when no parentheses. | | " " | Phrase search; double-quoted string, words and order must match, e.g. name:"john Smith". No logical operators inside phrase. | | ' ' | Phrase search; single quotes, same as ""; use when phrase contains double quotes, e.g. body:'user_name:"bob"' | | | Wildcard; zero or more chars, e.g. host:www.test.com. No prefix wildcard. | | >, >=, <, <=, = | Range operators for numeric values, e.g. status>400, status:>=400 | | \ | Escape; escaped char is literal. Escape space, :, (), >, =, <, ", ', * in values. | | key: | text: field exists (any value). long/double: field exists and is numeric, e.g. response_time: | | key:"" | text: field exists and is empty. long/double: value is not numeric or field missing, e.g. response_time:"" |
| Syntax | Description | |--------|-------------| | SELECT | Select from table; data from current log topic matching query condition | | AS | Alias for column (KEY) | | GROUP BY | With aggregate functions, group by one or more columns (KEY) | | ORDER BY | Sort result set by KEY | | LIMIT | Limit rows, default 100, max 1M | | WHERE | Filter raw data | | HAVING | Filter after GROUP BY, before ORDER BY; WHERE filters raw data | | Nested subquery | One SELECT inside another for multi-step analysis | | SQL functions | Richer analysis: IP geo, time format, string split/join, JSON extract, math, distinct count, etc. |
Retrieve log context around a given log.
clscli context <PkgId> <PkgLogId> --region <region> -t <TopicId>
Examples: --output=json, --output=csv, -o context.json (write to file)
| Option | Required | Type | Description | Example | |--------|----------|------|-------------|---------| | --region | yes | String | CLS region | ap-guangzhou | | -t, --topic | yes | String | Log topic ID | - | | PkgId | yes | String | Log package ID, i.e. SearchLog Results[].PkgId | 528C1318606EFEB8-1A7 | | PkgLogId | yes | Integer | Index within package, i.e. SearchLog Results[].PkgLogId | 65536 | | --output, -o | no | - | Output: json, csv, or file path | - |
安装 Tencent Cloud Log Service 后,可以对 AI 说这些话来触发它
Help me get started with Tencent Cloud Log Service
Explains what Tencent Cloud Log Service does, walks through the setup, and runs a quick demo based on your current project
Use Tencent Cloud Log Service to query and analyze Tencent Cloud CLS logs
Invokes Tencent Cloud Log Service with the right parameters and returns the result directly in the conversation
What can I do with Tencent Cloud Log Service in my developer & devops workflow?
Lists the top use cases for Tencent Cloud Log Service, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/clscli/ 目录(个人级,所有项目可用),或 .claude/skills/clscli/(项目级)。重启 AI 客户端后,用 /clscli 主动调用,或让 AI 根据上下文自动发现并使用。
Tencent Cloud Log Service 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Tencent Cloud Log Service 可免费安装使用。请查阅仓库了解许可证信息。
Query and analyze Tencent Cloud CLS logs
Tencent Cloud Log Service 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my developer & devops tasks using Tencent Cloud Log Service
Identifies repetitive steps in your workflow and sets up Tencent Cloud Log Service to handle them automatically