Observer log analysis

From oceanbase/obdiag · View interactive version

Observer log analysis is an AI agent skill from the GitHub repository oceanbase/obdiag. 标准 SOP:OceanBase 集群侧(observer/election/rootservice)日志采集、过滤与 analyze 解读。用户要收集日志、trace_id/关键词过滤、分析错误栈或慢 SQL 在 observer 日志中的线索时使用。OBProxy 日志请用 obproxy-log-analysis。

How to use this skill

Skill file

日志排障(集群侧)— SOP

触发与边界

前置条件

分支:选路径

| 用户意图 | 走哪条 |

|----------|--------|

| 只要拉日志、不要求「分析/解读」 | 阶段 1 完成后可结束;简要告知输出目录。 |

| 采集 + 分析 同一句,或要求解读错误/慢 SQL 日志 | 阶段 1 → 同一轮内继续阶段 2(及必要时阶段 3)。 |

| 已有 obdiag_gather_pack_* 目录,只要分析 | 跳过阶段 1,从阶段 2 进入(目录内 file_list / file_read;大包配合 run_shell 的 head/grep)。 |

阶段 1:采集(gather_log)

目的:从节点拉取集群侧日志到本机 pack。

动作:

完成标准:

阶段 2:解读(与采集链式)

目的:基于日志内容回答「错误原因 / 时间线 / 是否需扩大窗口」。

动作(按序):

  1. 若刚完成阶段 1:对 pack 目录 file_list(可用 pattern 缩小范围);大文件或压缩包用 run_shell 做 head/tail/grep 或解压(需用户审批)。
  2. 统计/聚合类 observer 日志分析(obdiag analyze log 能力范围):调用 analyze_log(scope 与 CLI 一致:observer、election、rootservice、all 等)。
  3. 若用户要原文行级核对:在 pack 内 file_read 读具体文件片段。

完成标准:

同一轮内链式(重要):若用户请求包含 分析/解读,不得仅在 gather_log 成功后用一句话结束;须在 同一 agent 运行 内继续 file_list → analyze_log 和/或 file_read → 再自然语言总结。

阶段 3:深挖(可选)

目的:计划与日志交叉验证。

动作:若有 trace_id,可再 gather_plan_monitor(计划监控)或 gather_log 缩小 grep;单条 SQL 性能主线见 observer-sql-analysis。

完成标准:用户问题已闭环或已指向下一 skill(如 SQL 深查、OBProxy、RCA)。

工具速查

| 目的 | 工具 |

|------|------|

| 集群侧日志采集 | gather_log |

| 集群侧日志 analyze(非 OBProxy) | analyze_log |

| 包内浏览 / 读文件 | file_list、file_read |

| 抽样 / 解压 | run_shell(审批) |

| 单条 SQL 计划包(非「收日志」) | gather_plan_monitor |

与其它 skill

| 需求 | 使用 |

|------|------|

| OBProxy | obproxy-log-analysis |

| 巡检 / RCA | obdiag-check-rca |

| 单条 SQL、锁 | observer-sql-analysis |

| 官方文档参数 | oceanbase-knowledge |

| OMS → Kafka 同步性能、延迟、KafkaSink | oms-kafka-performance |

输出与自检

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.