← Back to Skills Marketplace
jeweis

阿里云日志查询

by Jewei · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
123
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install aliyun-log-query
Description
当需要查询阿里云日志(SLS)时使用此技能,支持 CLI 查询日志、分析数据。
README (SKILL.md)

安装

使用 uv 安装 CLI:

uv pip install -U aliyun-log-cli

确认安装:

aliyunlog --version

配置认证

CLI 支持三种方式(优先级:命令行参数 > 环境变量 > 配置文件)。

如果用户没有提供 access_id 和 access_key,需要引导用户提供后再执行查询。

方式一:configure 命令(推荐)

aliyunlog configure \x3Caccess_id> \x3Caccess_key> \x3Cendpoint>

示例:

aliyunlog configure LTAIxxxxxxxx xxxxxxxxx cn-hangzhou.log.aliyuncs.com

使用 HTTPS:

aliyunlog configure LTAIxxxxxxxx xxxxxxxxx https://cn-hangzhou.log.aliyuncs.com

配置文件位置:~/.aliyunlogcli,默认账号块名是 main

方式二:命令行直接传参数

aliyunlog log get_log_all \
  --access-id=\x3Cvalue> \
  --access-key=\x3Cvalue> \
  --region-endpoint=\x3Cvalue> \
  --project=\x3Cvalue> \
  --logstore=\x3Cvalue> \
  ...

SDK 方法到 CLI 命令的映射规则

规则:aliyunlog log \x3C子命令> 映射到 SDK LogClient 的方法名,参数一一对应。

示例:

  • client.create_logstore(project_name, logstore_name, ttl=2, shard_count=30)
  • aliyunlog log create_logstore --project_name=... --logstore_name=... --ttl=... --shard_count=...

日志查询(SQL 方式)

使用 --power_sql=true 启用增强 SQL 模式,通过 SQL 的 LIMIT 控制返回条数,避免数据量过大导致上下文爆满。

如果用户没有指定 project 和 logstore,先查阅 references/project_mapping.md 查找对应的值。

Command Template

aliyunlog log get_log_all \
  --project="{{project}}" \
  --logstore="{{logstore}}" \
  --from_time="{{from_time}}" \
  --to_time="{{to_time}}" \
  --query="* | SELECT * FROM log WHERE {{query}} LIMIT {{limit}}" \
  --power_sql=true

Inputs

参数名 必填 说明
project SLS 项目名
logstore 日志库名
from_time 开始时间(字符串如 "2026-03-18 10:00:00" 或时间戳)
to_time 结束时间
query SQL WHERE 条件(默认 "1=1" 表示无过滤)
limit 最大返回条数(默认 10)

Behavior

  1. query 转化为 SQL WHERE 条件
  2. 自动拼接 SELECT * FROM log WHERE \x3Cquery> LIMIT \x3Climit>
  3. 启用 --power_sql=true
  4. 默认 limit=10,避免输出过大

重要:不要一次查全部日志,始终使用 LIMIT 限制返回条数。

Examples

1. 查询全部日志(限制 10 条)

aliyunlog log get_log_all \
  --project="my-project" \
  --logstore="app-log" \
  --from_time="2026-03-18 10:00:00" \
  --to_time="2026-03-18 11:00:00" \
  --query="1=1" \
  --limit=10 \
  --power_sql=true

2. 查询错误日志

aliyunlog log get_log_all \
  --project="my-project" \
  --logstore="app-log" \
  --from_time="2026-03-18 10:00:00" \
  --to_time="2026-03-18 11:00:00" \
  --query="log like '%ERROR%'" \
  --limit=10 \
  --power_sql=true

3. 字段过滤

aliyunlog log get_log_all \
  --project="my-project" \
  --logstore="app-log" \
  --from_time="2026-03-18 10:00:00" \
  --to_time="2026-03-18 11:00:00" \
  --query="status = 500" \
  --limit=10 \
  --power_sql=true

4. URL 统计

aliyunlog log get_log_all \
  --project="my-project" \
  --logstore="app-log" \
  --from_time="2026-03-18 10:00:00" \
  --to_time="2026-03-18 11:00:00" \
  --query="* | SELECT url, COUNT(*) AS cnt GROUP BY url ORDER BY cnt DESC LIMIT 10" \
  --power_sql=true

输出格式

格式化 JSON 输出

aliyunlog log list_project --format-output=json,no_escape

设置默认格式

aliyunlog log configure --format-output=json,no_escape

默认输出

{
  "logs": [...],
  "count": 100,
  "total": 1000
}

Error Handling

  • CLI 执行失败 → 输出 stderr
  • 无结果 → {"logs": [], "count": 0}

Notes

SQL WHERE 条件语法:

  • 全文搜索:log like '%ERROR%'
  • 字段过滤:status = 500method = 'GET'
  • 组合条件:log like '%ERROR%' AND status = 500

统计类查询(无 WHERE)直接写完整 SQL:

  • * | SELECT url, COUNT(*) AS cnt GROUP BY url LIMIT 10

建议:

  • 限制时间范围避免慢查询
  • 默认 limit=10,避免输出过大
Usage Guidance
This skill appears to do what it says (query Aliyun SLS) but pay attention before supplying credentials. The SKILL.md expects access_id/access_key and to write a config file (~/.aliyunlogcli), yet the registry metadata does not declare those requirements — that mismatch should be resolved by the publisher. If you install/use it: - Prefer using a low-privilege or temporary STS token, not long-lived production keys. - Avoid passing secrets on the command line when possible (they appear in process listings); prefer environment variables or config files with appropriate file permissions. - Validate the pip package 'aliyun-log-cli' (source, maintainer, PyPI page) before installing. - Confirm your agent environment supports the suggested 'uv pip' invocation or adapt to your normal pip/venv workflow. - If you need stricter controls, do not grant autonomous invocation or supply credentials until you confirm package provenance and the exact runtime behavior.
Capability Analysis
Type: OpenClaw Skill Name: aliyun-log-query Version: 1.0.0 The skill bundle provides a legitimate interface for querying Alibaba Cloud Log Service (SLS) using the official 'aliyun-log-cli' tool. The instructions in SKILL.md are well-structured, focusing on installation, authentication, and SQL-based log retrieval with safety limits to prevent context overflow. No evidence of data exfiltration, malicious execution, or harmful prompt injection was found; the credential handling and project mapping logic are consistent with the tool's stated purpose.
Capability Assessment
Purpose & Capability
Name/description match the instructions: the SKILL.md describes installing an Aliyun SLS CLI and running queries. However the registry metadata declares no required credentials or config paths while the instructions clearly require access_id/access_key and write/read a config file (~/.aliyunlogcli). This mismatch is an incoherence in the manifest.
Instruction Scope
Instructions stay within the stated purpose (install CLI, configure credentials, run queries). They instruct the agent to prompt the user for access_id/access_key and to consult/append the local references/project_mapping.md. They do not ask to read unrelated system files. Caveat: they recommend passing credentials as CLI flags and storing credentials in a plaintext config, both of which can leak secrets (process lists, disk).
Install Mechanism
This is an instruction-only skill (no install spec). The doc tells users to run a pip install (uv pip install -U aliyun-log-cli). That is a reasonable approach, but 'uv pip' is an environment-specific wrapper not declared in metadata; the package name should be validated (source/trust of 'aliyun-log-cli' on PyPI). No remote arbitrary downloads or extract steps are present.
Credentials
The skill requires Aliyun access_id/access_key to operate, but the registry metadata lists no required env vars or primary credential and no required config path. The SKILL.md also instructs storing credentials in ~/.aliyunlogcli and passing creds via command-line flags — both increase the risk of credential exposure. The absence of declared credential requirements in metadata is a notable mismatch.
Persistence & Privilege
always is false and the skill does not request elevated platform privileges. It does instruct creating/updating a local config file (~/.aliyunlogcli) and appending entries to references/project_mapping.md; these are limited to the skill's own files and are normal but you should be aware they persist credentials/mappings on disk.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install aliyun-log-query
  3. After installation, invoke the skill by name or use /aliyun-log-query
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
阿里云日志查询
Metadata
Slug aliyun-log-query
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is 阿里云日志查询?

当需要查询阿里云日志(SLS)时使用此技能,支持 CLI 查询日志、分析数据。 It is an AI Agent Skill for Claude Code / OpenClaw, with 123 downloads so far.

How do I install 阿里云日志查询?

Run "/install aliyun-log-query" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is 阿里云日志查询 free?

Yes, 阿里云日志查询 is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does 阿里云日志查询 support?

阿里云日志查询 is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created 阿里云日志查询?

It is built and maintained by Jewei (@jeweis); the current version is v1.0.0.

💬 Comments