# Lambda Logs Zh

> 拉 AWS Lambda 的 CloudWatch 最近报错,按频次聚类并给中文根因摘要。当用户说"看 lambda 日志 / lambda 报错排查 / 这个函数出错了 / 查 CloudWatch"时触发。脚本负责取日志,Claude 负责聚类去重 + 中文根因 + 修复建议。

- **Type:** Skill
- **Install:** `agentstack add skill-yuaicode-ai-skills-lambda-logs-zh`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [YuAICode](https://agentstack.voostack.com/s/yuaicode)
- **Installs:** 0
- **Category:** [Cloud & Infrastructure](https://agentstack.voostack.com/c/cloud-infrastructure)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [YuAICode](https://github.com/YuAICode)
- **Source:** https://github.com/YuAICode/ai-skills/tree/main/skills/lambda-logs-zh

## Install

```sh
agentstack add skill-yuaicode-ai-skills-lambda-logs-zh
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# lambda-logs-zh — Lambda 报错中文速查

把 CloudWatch 里一大片重复报错,收敛成"几类问题 + 每类的中文根因和建议"。

## 何时触发

用户说"看下 xx 函数的 lambda 日志 / lambda 报错了 / 查 CloudWatch / 排查这个函数"。

## 用法

1. 取报错日志(需 aws CLI + 凭据):
   ```bash
   bash /bin/fetch-errors.sh  [窗口] [region]
   # 例:bash /bin/fetch-errors.sh my-func 6h ap-southeast-1
   # 或直传日志组:bash /bin/fetch-errors.sh --group /aws/lambda/my-func 24h
   ```
   窗口缺省 1h(支持 1h/6h/24h/7d)。输出 LOG_GROUP / WINDOW / ERRORS(原始报错文本)。
2. **聚类去重**:把 ERRORS 按"同一类错误"归并(忽略时间戳/requestId/具体值的差异),统计每类出现次数。
3. 对每类给出中文小结:
   - **现象**(报错关键行)· **出现次数** · **疑似根因** · **建议排查/修复方向**
   - 按次数从高到低排;高频的优先。
4. 报告读取范围(日志组 + 窗口)与"没覆盖到的"(如窗口外、非 ERROR 级)。

## 输出模板

```markdown
##  最近  报错小结(共 N 类 / M 条)

### 1.  ×
- 现象:``
- 疑似根因:
- 建议:

### 2. ...
```

## 硬规则

- **不臆造**:根因拿不准就说"需结合代码/调用上下文确认",别编。
- 聚类按错误**本质**归并,不要把同一类的不同 requestId 当成多类。
- 报错里若含疑似密钥/PII,在摘要里**打码**,不要原样回显敏感值。
- 只读日志,不改任何 AWS 资源。

## 边界

- 依赖 aws CLI + 已配置凭据/region;缺失时脚本会明确报错。
- 只看 CloudWatch Logs;不拉 X-Ray / 指标(需要的话另说)。

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [YuAICode](https://github.com/YuAICode)
- **Source:** [YuAICode/ai-skills](https://github.com/YuAICode/ai-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-yuaicode-ai-skills-lambda-logs-zh
- Seller: https://agentstack.voostack.com/s/yuaicode
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
