Files
zk-data-agent/skills/elk-fetch/README.md
T
2026-05-08 10:54:27 +08:00

38 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# elk-fetch
按 request id 查 ELK / Elasticsearch 日志的小工具 + Claude Code Skill。
**核心能力**
- 绕开 Kibana CAS 登录,直接走 ES HTTP API
- 多账号 profile(不同业务用不同 ES 账号,支持多 ES 集群)
- 多业务 preset(业务语义 → 索引/字段/过滤条件,一键套用)
- 深度 JSON 字段自动解析(如 `rejectInfo` / `message` / `key_value` / `response_infos` 里的嵌套 JSON
- 按点号路径(`a.b.0.c`)提取嵌套字段 / 仅输出指定字段
## 快速开始
```bash
git clone git@git.n.xiaomi.com:zhongsiyao/elk-fetch.git
cd elk-fetch
pip install "elasticsearch<8" urllib3
# 默认查主 NLP 日志
python elk_query.py <your_request_id>
```
账号密码(团队共用)已经在仓库里的 `profiles.json` 中,clone 完即可用。想用自己的账号则 `ELK_FETCH_PROFILES=/path/to/profiles.json` 指向别处。
## 完整用法
- **怎么选 preset / Kibana URL 转参数 / 命令模板** → [`SKILL.md`](SKILL.md)
- **每张表的字段 schema / JSON 字符串内部结构 / 新增索引流程** → [`INDEX_CATALOG.md`](INDEX_CATALOG.md)
- **业务深入**(每个主题一份排查 playbook)→ [`business/`](business/)
- [`business/keyword-free.md`](business/keyword-free.md) — 免唤醒判决(拒识 / kwfree 两张表三个视角)
- [`business/intent-arbitrator.md`](business/intent-arbitrator.md) — 中控仲裁
- [`business/micar-onetrack.md`](business/micar-onetrack.md) — 小米汽车 OneTrack 端侧埋点
## 作为 Claude Code Skill 使用
把本仓库 clone / 软链到 `~/.claude/skills/elk-fetch/`Claude Code 会根据 `SKILL.md` 的触发条件(给出 Kibana 链接、提到 requestId / 某类业务日志等)自动调用。