diff --git a/CLAUDE.md b/CLAUDE.md index 04b329adad..489a800c38 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -21,6 +21,7 @@ docs/ → Setup guides for different tools **Verify:** browser-testing-with-devtools, debugging-and-error-recovery **Review:** code-review-and-quality, code-simplification, security-and-hardening, performance-optimization **Ship:** git-workflow-and-versioning, ci-cd-and-automation, deprecation-and-migration, documentation-and-adrs, shipping-and-launch +**Operate:** ce-log-triage, rca-writeup ## Conventions diff --git a/README.md b/README.md index 4cb35ad8fb..f6556a214a 100644 --- a/README.md +++ b/README.md @@ -160,9 +160,9 @@ Skills are plain Markdown - they work with any agent that accepts system prompts --- -## All 23 Skills +## All 25 Skills -The commands above are entry points. The pack includes 23 skills total — 22 lifecycle skills plus the `using-agent-skills` meta-skill. Each skill is a structured workflow with steps, verification gates, and anti-rationalization tables. You can also reference any skill directly. +The commands above are entry points. The pack includes 25 skills total — 24 lifecycle and operations skills plus the `using-agent-skills` meta-skill. Each skill is a structured workflow with steps, verification gates, and anti-rationalization tables. You can also reference any skill directly. ### Meta - Discover which skill applies @@ -222,6 +222,13 @@ The commands above are entry points. The pack includes 23 skills total — 22 li | [documentation-and-adrs](skills/documentation-and-adrs/SKILL.md) | Architecture Decision Records, API docs, inline documentation standards - document the *why* | Making architectural decisions, changing APIs, or shipping features | | [shipping-and-launch](skills/shipping-and-launch/SKILL.md) | Pre-launch checklists, feature flag lifecycle, staged rollouts, rollback procedures, monitoring setup | Preparing to deploy to production | +### Operate - Respond to production incidents + +| Skill | What It Does | Use When | +|-------|-------------|----------| +| [ce-log-triage](skills/ce-log-triage/SKILL.md) | Root-cause CE failures from CloudWatch/syslog — walks state machines, matches failure signatures across AWS account boundaries | CE provisioning failures, stuck/down states, log analysis | +| [rca-writeup](skills/rca-writeup/SKILL.md) | Converts a completed log investigation into a structured, shareable RCA document | After root cause is found — drafting postmortems, incident reports, or ticket summaries | + --- ## Agent Personas @@ -284,7 +291,7 @@ Every skill follows a consistent anatomy: ``` agent-skills/ -├── skills/ # 23 skills (22 lifecycle + 1 meta) +├── skills/ # 25 skills (24 lifecycle/ops + 1 meta) │ ├── interview-me/ # Define │ ├── idea-refine/ # Define │ ├── spec-driven-development/ # Define @@ -307,6 +314,8 @@ agent-skills/ │ ├── deprecation-and-migration/ # Ship │ ├── documentation-and-adrs/ # Ship │ ├── shipping-and-launch/ # Ship +│ ├── ce-log-triage/ # Operate +│ ├── rca-writeup/ # Operate │ └── using-agent-skills/ # Meta: how to use this pack ├── agents/ # 3 specialist personas ├── references/ # 4 supplementary checklists diff --git a/copilot-instructions.md b/copilot-instructions.md index 3197c77ebe..87ddcaf267 100644 --- a/copilot-instructions.md +++ b/copilot-instructions.md @@ -31,6 +31,8 @@ When a task arrives, identify the phase and follow the corresponding skill: | Writing or running tests | test-driven-development | | Browser-based testing | browser-testing-with-devtools | | Something broke | debugging-and-error-recovery | +| Infrastructure / CE failure analysis | ce-log-triage | +| Writing an RCA / incident postmortem | rca-writeup | | Reviewing code before merge | code-review-and-quality | | Security concerns | security-and-hardening | | Performance concerns | performance-optimization | diff --git a/scripts/validate-skills.js b/scripts/validate-skills.js index 65a86d6d71..e9db1a3758 100644 --- a/scripts/validate-skills.js +++ b/scripts/validate-skills.js @@ -46,6 +46,8 @@ const REQUIRED_SECTIONS = [ const SECTION_EXEMPT_SKILLS = { 'using-agent-skills': 'Meta-skill — orchestrates other skills; When-to-Use and Verification are not applicable to a routing document.', 'idea-refine': 'Legacy structure predating skill-anatomy.md — uses How-It-Works/Usage/Anti-patterns instead of standard headings. Tracked for conformance in https://github.com/addyosmani/agent-skills/issues', + 'ce-log-triage': 'Domain-specific infrastructure triage playbook — uses architecture-reference + state-machine + failure-signature-catalog structure. Covering sections embedded within the triage workflow.', + 'rca-writeup': 'Domain-specific RCA formatting template — uses input-contract + output-template + worked-examples structure. Guidance embedded within the formatting workflow.', }; // Regex patterns that indicate an explicit cross-skill reference. diff --git a/skills/ce-log-triage/SKILL.md b/skills/ce-log-triage/SKILL.md new file mode 100644 index 0000000000..6957224321 --- /dev/null +++ b/skills/ce-log-triage/SKILL.md @@ -0,0 +1,625 @@ +--- +name: ce-log-triage +description: > + Root-cause Teradata Compute Engine (CE) failures from logs. Use this skill + whenever a CE (IDs like CEAMGPSCTEAM0009R, CEAMTESTSIT10003Q) or its site + (IDs like TDICAM53386PP80) is stuck, failed, or not starting — states such as + provisioning_failed, down/hardstop, down/tdmaint, stopped, NOT_PROVISIONED, or + "configuring / expand vconfig", and stuck control-plane states such as + NETWORK_PROVISIONING or MANIFEST_CREATING — and the user provides or points at + CloudWatch Logs Insights JSON exports (logs-insights-results__NN_.json), a + Linux `messages` syslog, or a Salt `minion` log. Trigger it for ANY request + shaped like "why is this CE failing / stuck / not starting", "analyze these CE + logs", "what's the root cause", "this engine won't provision", or a pasted CE + ID plus a state — even if the user does not name a state, a file, or this skill + explicitly. The CE lifecycle is split across several services that each live in + a DIFFERENT AWS account, and the failure trail crosses those boundaries, so do + NOT analyze from general AWS knowledge or guess from the symptom alone — follow + this skill to identify which layer the logs belong to, read the right log the + right way, walk the correct state machine, and match the evidence against a + catalog of previously diagnosed failure signatures before declaring a cause. +license: internal +--- + +# CE Log Triage + +Compute Engine failures are hard for one structural reason: **the lifecycle is +split across services that each live in a different AWS account, and the failure +trail crosses those account boundaries.** A symptom observed by one service +(e.g. "status stuck in `MANIFEST_CREATING`", or a node reporting +`expand vconfig / configuring` forever) is almost always *caused* by a different +service — or a different layer — upstream. Done by hand this takes 30–90 minutes +per incident, demands deep tribal knowledge, and is error-prone because humans +are bad at mentally merging ten interleaved log streams and remembering which +account owns which step. + +This skill encodes that tribal knowledge: the architecture, how the services +hand off to each other, both state machines, the exact shape of the two log +formats, and a playbook of failure signatures recovered from real past +investigations. The goal is to go **straight to root cause** instead of +rediscovering the terrain every time. + +When the investigation is finished and the user wants a shareable document +(postmortem / RCA / incident writeup), hand the findings to the **`rca-writeup`** +skill — this skill produces the *conclusion*; `rca-writeup` produces the +*artifact*. They are designed to compose. + +--- + +## Table of contents + +1. [The two layers — decide which one first](#the-two-layers) +2. [The triage workflow (8 steps)](#the-triage-workflow) +3. [Reference A — System architecture and how services communicate](#reference-a) +4. [Reference B — The two state machines](#reference-b) +5. [Reference C — Log-format anatomy](#reference-c) +6. [Reference D — Failure-signature playbook](#reference-d) +7. [Bundled scripts](#bundled-scripts) +8. [Caveats and honesty rules](#caveats) + +--- + + +## 1. The two layers — decide which one first + +Before reading a single line in detail, classify the evidence. There are **two +distinct layers**, they fail for different reasons, and they are documented by +different log formats. Getting this classification right up front saves the +whole investigation. + +| | **Control plane** | **On-host / node layer** | +|---|---|---| +| What it does | *Provisions and tracks* the CE: authorize → resolve config → create record → provision network/PrivateLink → create manifest → schedule ECS task → run | Brings up the actual **Teradata database** on the CE nodes: PDE, TPA, vconfig, BYNET, Salt orchestration | +| Who runs it | GCS, Metadata, Network, Scheduler, Auto-Suspend, Metering (Lambdas / ECS / SQS across several AWS accounts) | Salt master + minions on the EC2 nodes; PDE / DBS on the box | +| Evidence format | **CloudWatch Logs Insights JSON** — `logs-insights-results__NN_.json` | **Linux syslog** — a `messages` file or a Salt `minion` log | +| Typical stuck states | `NETWORK_PROVISIONING`, `MANIFEST_CREATING`, `provisioning_failed`, `NOT_PROVISIONED` | `down/hardstop`, `down/tdmaint`, `stopped`, `configuring / expand vconfig` | +| Read strategy | Parse JSON with Python (jq is usually absent, files run ~40 MB) | `grep` for anchors + `sed -n` a line window (40k+ lines, middle truncated by any viewer) | + +A single incident can span **both** layers, and the most instructive cases do. +The canonical example: the control-plane status shows the CE stuck, but the +*cause* is a PDE crash on the node during an `expand vconfig` reconfiguration +(see signature **S2**/**S5**). When you have logs from both layers, reconcile +them on a shared UTC timeline — the on-host crash timestamp should line up with +where the control-plane status stopped advancing. + +--- + + +## 2. The triage workflow (8 steps) + +Follow these in order. Each step explains *why* it matters, because skipping the +reasoning is how a triage lands on a plausible-but-wrong cause. + +### Step 1 — Pin the basics + +Establish, and write down, four facts before touching the logs: + +- **CE ID** (e.g. `CEAMGPSCTEAM0009R`) and/or **site ID** (e.g. `TDICAM53386PP80`). + These are your grep key for everything downstream. +- **The reported state** exactly as given (`provisioning_failed`, + `down/hardstop`, `configuring / expand vconfig`, …). The state tells you which + layer and which state machine to walk. +- **The environment** (preprod / prod / sit). This matters because **AWS account + IDs differ per environment** — see Reference A and verify rather than assume. +- **The time window** of interest, in **UTC**. Logs from different services use + different local offsets; normalize everything to UTC immediately or the + timeline will silently mislead you. + +If the node is reachable, the fastest ground-truth for the on-host layer is the +provisioning-status endpoint: + +``` +curl -s http://localhost:22222/provisioning-status +# → {"engine":{"state":"configuring","stage":"expand vconfig","version":"20.00.31.58CE4-1"}} +``` + +### Step 2 — Inventory the files before loading them + +Do **not** `cat` a 40 MB JSON or a 40k-line syslog into context. First, size +them and read only the boundaries: + +```bash +wc -l +head -5 +echo "---" +tail -5 +``` + +This tells you the format (JSON array vs syslog), the time span covered, and +whether the file is truncated. For the syslog, it also reveals the timestamp +format you'll need for `sed` windows. For the JSON, confirm it's an array of +`{"@timestamp", "@message"}` entries (Reference C) and note that bulk entries +like a `ListComputeEngineConfigs response` (`count: 214`, huge `items` array) +are noise to skip. + +### Step 3 — Build a UTC timeline + +Extract the events relevant to this CE into a single chronological, UTC timeline. +This is the spine of the whole investigation — every later claim hangs off "what +happened, in what order." + +- **Control-plane (JSON):** filter `@message` entries to those mentioning the CE + ID, and pull `level`, `msg`, `operation`, `status`, `connectivity`, + `error_code`, plus the timestamp. Use `scripts/parse_cloudwatch.py --timeline` + (it handles dict-vs-string `@message` and skips bulk entries). +- **On-host (syslog):** grep the anchors (Reference C), find the **transition + line** where the state changed, then `sed -n ',p'` a window around + it to see the surrounding sequence. Use `scripts/triage_syslog.sh`. + +Each timeline entry should record not just *what* the log said but *what it +proves*. "06:43:23 — PDE Event 13912 (reconcile failed)" proves the reconfigure +aborted; "06:44:23 — DBS DOWN/HARDSTOP" proves the DB then went down. + +### Step 4 — Map events to the state machine + +Lay the timeline against the correct state machine (Reference B) and find the +**transition that did not fire**. The expected happy path is a known sequence; +the failure is wherever reality diverged. On the control plane, ask "which +service owns the transition that's missing?" — because that names the account +and service you'd escalate to. On the node, ask "which orchestration step +errored, and did the success/cleanup step ever run?" + +### Step 5 — Match against known failure signatures + +Compare the divergence point and its surrounding evidence against the +**failure-signature playbook (Reference D)**. Most real CE failures match one of +S1–S6. A signature gives you three things at once: the likely root cause, *where +to confirm it*, and the fix. Do not stop at "matches S2" — run the confirmation +step the signature names, because two signatures can present similarly (a stuck +`expand vconfig` is the *symptom* S5, but its *cause* is usually the PDE crash +S2). + +### Step 6 — Separate root cause from secondary noise + +A CE failure log is full of errors that **merely logged** but did not **cause** +anything. The discipline that makes a triage trustworthy is cleanly splitting +the load-bearing fault from the noise. Known benign-or-unrelated lines are +catalogued in Reference D ("Secondary noise"); the classic is treating a +`cloud-init: Unable to locate credentials` line or a ServiceNow `Org not found` +error as the cause when the real fault was a PrivateLink DNS timeout. State +explicitly: "X failed (root cause); Y and Z logged errors but were not on the +critical path." + +### Step 7 — Assign ownership + +Name *which account and service* owns the fault. This is the single most useful +output for the person who has to act, and it falls out of Steps 4–5 because each +state transition lives in a specific service/account. Order any next steps by +**authority of evidence**: CloudTrail / the authoritative log first, then +resolve the relevant role/ARN, then "ask the owning team" only when the logs +can't settle it. + +### Step 8 — Hand off to `rca-writeup` + +If the user wants a durable document, pass these findings to the `rca-writeup` +skill: one-line verdict, the UTC timeline, the root cause with its deciding +evidence, secondary issues kept separate, next steps ordered by authority, and a +caveats line for what the logs cannot prove. This skill's job ends at the +conclusion; `rca-writeup` formats it. + +--- + + +## 3. Reference A — System architecture and how services communicate + +### 3.1 The control-plane service map + +``` + ┌──────────────────┐ + │ API Consumer │ + │ (Portal / CLI) │ + └────────┬──────────┘ + │ REST API call + ▼ + API Gateway + Authorizer Lambda (validates token) + │ + ▼ + ┌─────────────────────────────────────────────────┐ + │ Global Compute Service (GCS) — acct 700562448506│ + │ • lifecycle API Lambda │ + │ • writes cluster record → DynamoDB │ + │ (cluster-provisioning-*) │ + │ • DynamoDB Stream → monitors: │ + │ Status Monitor (detects state changes) │ + │ Manifest Monitor (creates CE manifests) │ + │ PrivateLink Monitor (pooled networking) │ + └───────────────┬───────────────────────────────────┘ + │ resolves config / deploys + ┌────────────────┼─────────────────────────┐ + ▼ ▼ ▼ + ┌────────────┐ ┌────────────────┐ ┌──────────────────┐ + │ Metadata │ │ Network Svc │ │ Scheduler │ + │ Service │ │ acct │ │ acct 700562448506│ + │ acct │ │ 656901843610 │ │ │ + │ 649897665836 │ • Sites/Status │ │ • ECS task that │ + │ • CE configs │ DDB tables │ │ runs the CE │ + │ • Orgs │ │ • PrivateLink │ │ │ + │ • Sites │ │ • VPC flow logs│ │ │ + └─────┬──────┘ └────────────────┘ └────────┬──────────┘ + │ config events │ deploys + ▼ ▼ + ┌──────────────┐ ┌──────────────────┐ + │ Auto-Suspend │ ◄──── idle events ───── │ Compute Engine │ + │ SQS Processor│ │ (customer OR │ + │ acct │ │ pooled account) │ + │ 700562448506 │ └──────────────────┘ + └──────────────┘ +``` + +The **key insight**: each state transition happens in a *different* service, +often in a *different* AWS account. That is exactly why debugging is hard and +why "which transition is missing?" (Step 4) immediately points at an owner. + +### 3.2 AWS account topology — VERIFY per environment + +These are the account IDs observed in past investigations. **Account IDs shift +between preprod / prod / sit**, so treat this as a starting map and confirm +against the actual ARNs in the logs (the queue/topic ARNs carry the account ID). + +| Service / role | Account (observed) | Notes | +|---|---|---| +| Global Compute Service (GCS), Scheduler, Auto-Suspend SQS processor | `700562448506` | Also the **publisher** account for the metering SNS topic | +| Metadata Service (CE configs, orgs, sites) | `649897665836` | Also the **consumer** account for the metering SQS queue | +| Global Network Service (VPC, PrivateLink, sites/status) | `656901843610` | The account to escalate network/PrivateLink faults to | +| Customer-allowed / pooled accounts | e.g. `210987654321`, `700562448506` | From `allowed_accounts` in `pooled_network_settings` | + +### 3.3 Communication chain 1 — provisioning + +``` +API Consumer → API Gateway + Authorizer → GCS lifecycle Lambda + → DynamoDB cluster-provisioning-* (write) + → DynamoDB Stream → GCS monitors (Status / Manifest / PrivateLink) + → Metadata Service (resolve CE config, org, site) + → Network Service (provision VPC + PrivateLink; pooled → endpoint service) + → Scheduler (create/update ECS task) + → Compute Engine runs (customer or pooled account) +``` + +When provisioning stalls, walk this chain forward from the last successful step. + +### 3.4 Communication chain 2 — metering / health (the "flap" path) + +This chain is the source of the metering **health-flap** signature (S4), and its +log shape is the trickiest to read (the triple-nested envelope in Reference C). + +``` +CE / agent emits health + → SNS topic global-compute-engine-metering-service-preprod (acct 700562448506) + → SQS queue metering-service-events-preprod (acct 649897665836) + → consumer logs "Received SQS event" + body (JSON string) → TopicArn + Message (double-escaped JSON string) + Message → { ce_siteid, status } # e.g. status: healthy | critical + attributes.SenderId = AROA…:AWS-CLOUDCAST # publishing role + attributes.ApproximateReceiveCount = N # redelivery counter +``` + +The crucial diagnostic fact: a flapping `healthy/critical` here is **publisher- +side** and does **not** mean the CE itself is down. Cross-check EC2 uptime over +the same window before acting. + +### 3.5 Communication chain 3 — on-host DB bring-up (Teradata node layer) + +``` +Salt master → Salt minion(s) on the CE nodes + orchestration: + expand vconfig → writes the Vconfig GDO ("NNNN bytes ... written to Vconfig GDO") + run_tpareconfig → sets tosstate RECONFIG, runs /usr/pde/bin/tpareconfig + wait_normal_system_state → polls tosstate / is_normal until NORMAL + PDE manages the DB process (TPA); DBS state: Active ↔ DOWN/HARDSTOP | DOWN/TDMAINT + BYNET is the inter-node interconnect (UDP ports 1033 / 1034) + healthcheck.json (/var/opt/teradata/salt/healthcheck/healthcheck.json) records stage+state + /provisioning-status (localhost:22222) surfaces engine state/stage to the control plane +``` + +On a healthy expansion, the orchestration's final step resets `healthcheck.json` +to `stage: completed, state: configured`. If PDE crashes mid-reconfigure, the +error path never reaches that final step, leaving a **stale** marker (S5). + +--- + + +## 4. Reference B — The two state machines + +### 4.1 Control-plane lifecycle (CloudWatch JSON layer) + +``` +[API_REQUEST_RECEIVED] + → [AUTHORIZED] (Authorizer Lambda validates token) + → [CONFIG_RESOLVED] (Metadata Service provides config/org/site) + → [CLUSTER_RECORD_CREATED] (GCS writes cluster-provisioning DynamoDB) + → [NETWORK_PROVISIONING] (Network Service sets up VPC/networking) + └─ [PRIVATELINK_SETUP] (PrivateLink Monitor — pooled only) + → [NETWORK_READY] + → [MANIFEST_CREATING] (Manifest Monitor creates CE manifests) + → [MANIFEST_READY] + → [SCHEDULING] (Scheduler creates/updates ECS task) + → [DEPLOYING] (ECS task launching) + → [RUNNING] (Status Monitor detects running) + └─ [AUTO_SUSPEND_CONFIGURED] (SQS processor gets config from Metadata) + → [IDLE_DETECTED] (auto-suspend task on CE master node) + → [TERMINATING] → [TERMINATED] +``` + +Find the last state reached and the first that didn't. A CE "stuck in +`NETWORK_PROVISIONING`" means the Network Service step never completed — look at +PrivateLink (S1). "Stuck in `MANIFEST_CREATING`" points at the Manifest Monitor. + +### 4.2 On-host provisioning / DB lifecycle (syslog layer) + +``` +engine.state / engine.stage (from /provisioning-status and healthcheck.json): + configuring / "expand vconfig" ──success──▶ configured / "completed" + ──failure──▶ STALE marker (stays "configuring") + +DBS state: + Active ──reconfigure failure──▶ DOWN/HARDSTOP (does NOT self-heal) + ──maintenance──────────▶ DOWN/TDMAINT +``` + +`DOWN/HARDSTOP` is terminal without intervention: the DB will not recover on its +own, so any "stuck stage" sitting on top of a HARDSTOP is a downstream symptom, +not the cause. + +--- + + +## 5. Reference C — Log-format anatomy + +### 5.1 CloudWatch Logs Insights JSON (`logs-insights-results__NN_.json`) + +- A **JSON array** of entries: `{"@timestamp": "...Z", "@message": ...}`. +- `@message` is **sometimes a dict** (structured: `level`, `msg`, `ce_siteid`, + `operation`, `status`, `connectivity`, `error_code`, …) **and sometimes a + plain string** (e.g. a line mentioning the CE and `NOT_PROVISIONED`). Any + parser must handle both shapes or it will crash or silently drop events. +- Files routinely run **~40 MB**. **`jq` is usually absent** on the box and the + **network is off**, so fall back to Python's stdlib `json` every time — this + is precisely what `scripts/parse_cloudwatch.py` is for. +- **Skip bulk entries.** A `ListComputeEngineConfigs response` with `count: 214` + and a large `items` array is inventory noise, not a lifecycle event. + +### 5.2 The triple-nested SQS → SNS → Message envelope + +Metering entries are nested three deep, with two of the layers stored as escaped +JSON *strings* (not objects). Decoding requires two `json.loads` hops: + +``` +@message +└─ sqsEvent.Records[ ] + ├─ eventSourceARN = arn:aws:sqs:us-west-2:649897665836:metering-service-events-preprod + ├─ attributes.SenderId = AROA3TYMO3BGFNSFCVJZ6:AWS-CLOUDCAST + ├─ attributes.ApproximateReceiveCount = "1" # ← redelivery counter + └─ body (JSON *string*) ── json.loads ─▶ + ├─ TopicArn = arn:aws:sns:us-west-2:700562448506:global-compute-engine-metering-service-preprod + └─ Message (double-escaped JSON *string*) ── json.loads ─▶ + └─ { "ce_siteid": "...", "status": "healthy" | "critical" } +``` + +Two diagnostics fall straight out of this structure: +- **Flap detection** — collect `status` per `ce_siteid` over time; alternating + `healthy`/`critical` while the EC2 stays up is signature **S4**. +- **Redelivery** — a high `ApproximateReceiveCount` (e.g. `4`) means SQS + redelivered the message (consumer failures / visibility-timeout expiry), which + can amplify an apparent flap. Note it; it's a clue, not usually the root cause. + +### 5.3 Decoding `SenderId` / `AROA…` role IDs + +`SenderId` looks like `AROA:` (here +`AROA3TYMO3BGFNSFCVJZ6:AWS-CLOUDCAST`). The `AROA` prefix marks an **IAM role** +unique-id, and the session name (`AWS-CLOUDCAST`) identifies the publisher. Use +it to attribute *which role/service* put the message on the queue; cross- +reference the queue/topic ARNs for the owning **account IDs**. + +### 5.4 The `messages` / Salt `minion` syslog + +- **40k+ lines**; any viewer (and most editors) **truncate the middle**, so + never trust a scroll-through. Work by `grep` + `sed -n ',p'` windows. +- Find the **transition line** first (the moment the state changed), then read a + window around it. The earlier successful run of the same orchestration is the + best control: diff its sequence against the failed one. + +### 5.5 grep / sed anchors that pay off + +``` +HARDSTOP DOWN/HARDSTOP DOWN/TDMAINT +"PDE is not operational" "Cannot open PDE device" +tosstate tpareconfig run_tpareconfig is_normal +vconfig "Vconfig GDO" expand +"Event 13912" "Event 13895" "failed reconcile" +BYNET "lost contact" eth0-udp-1033 eth0-udp-1034 +salt-master salt-minion healthcheck +tdinfo vprocmanager "node_num" "retcode 61" +ce-autoscaler scale-up +# secondary / noise: +"Unable to locate credentials" "unrecognised disk label" "Org not found" +``` + +--- + + +## 6. Reference D — Failure-signature playbook + +Each signature lists **symptom → root cause → how to confirm → fix**. Match the +divergence point from Step 4 here, then *run the confirmation* before declaring +the cause. + +### S1 — PrivateLink DNS verification timeout (control plane) + +- **Symptom.** CE stuck in `NETWORK_PROVISIONING` / `provisioning_failed`. JSON + shows `operation: PRIVATE_LINK_DEPLOY`, `status: WAITING_DNS`, then an `ERROR` + `private dns verification timed out`, `error_code: AWS-AssignSlot-Error`, + `connectivity: FAILED`. +- **Root cause.** The Network Service created the domain-verification **TXT + record** in the CE's Route 53 hosted zone and polled (~10 min), but AWS never + marked the endpoint-service private-DNS name **verified**, so slot assignment + failed. +- **Confirm.** In the Route 53 hosted zone for the CE domain: is the TXT record + present? Is the VPC **endpoint service** "Private DNS name" domain-verification + status `verified`? Check the verification window/timeout in the network + service code path (`ce_manager.go`). +- **Fix.** Re-trigger verification once TXT has propagated; confirm the endpoint + service domain verification flips to verified; escalate to the Network Service + owner (acct `656901843610`) if AWS-side verification keeps timing out. + +### S2 — PDE crash mid-reconfig → DOWN/HARDSTOP (on-host) + +- **Symptom / sequence** (timestamps from a real case): + - Autoscaler scale-up under sustained CPU (~85–91%): `ce-autoscaler` triggers + expansion. + - `06:43:16` `state.sls expand vconfig` runs; `2408 bytes successfully written + to Vconfig GDO`; healthcheck → `stage: "expand vconfig", state: "configuring"`. + - `06:43:19` `tdops.run_tpareconfig` sets `tosstate RECONFIG`, runs + `/usr/pde/bin/tpareconfig` (reports success in 0.1s). + - `06:43:22` `wait_normal_system_state` poll #1 → `is_normal=False` (expected). + - `06:43:23` **PDE Event 13912: "Node needed for online reconfiguration failed + reconcile"** → **Event 13895: forced TPA restart**. + - `06:43:27` `/usr/pde/bin/tosstate: PDE is not operational - Cannot open PDE + device` — repeats **12× at 5s**. + - `06:44:22` `run_tpareconfig` gives up: `tosstate persistently failing after + 12 attempts while waiting for NORMAL`. + - `06:44:23` **DBS → DOWN/HARDSTOP**, never recovers. Retry cycles + (`update_bynet_hosts` → `update_mpplist` → `tpa_snapshot`) all fail with + `tdinfo: Error, can't find node_num 34, byn001-02, in vconfig GDO` and + `vprocmanager: PDE is down or not completely up : Operation not permitted + (retcode 61)`. +- **Root cause.** The new follower node could not reconcile with the leader — + most likely the **BYNET was still processing the detachment of a previously + decommissioned node at the same slot**, and the **vconfig GDO had not yet been + updated** to include the new node. The reconcile failure (Event 13912) forced + the TPA restart, which produced a hard stop the system never recovered from. +- **Confirm.** The leader's `messages` log around the reconfigure window; the + vconfig GDO node list (the missing `node_num`); the prior decommission at that + slot. A follower `minion` log typically shows the follower executed every step + correctly — the fault is the leader's PDE, not the minion. +- **Fix.** Recover the **leader DB first** (DOWN/HARDSTOP will not self-heal), + then re-run the expansion orchestration; verify the slot/`node_num` is clean + before re-adding the node. + +### S3 — Follower node unreachable / BYNET degraded (on-host) + +- **Symptom.** Salt master completes the local node and **waits on the follower** + (e.g. `001-02`); BYNET logs `DEGRADED: lost contact with all nodes on + eth0-udp-1033` (and/or `-1034`). The cluster can't form. +- **Root cause.** The follower EC2 is unreachable on the BYNET UDP ports + (1033/1034) — instance health, security-group, or network reachability. +- **Confirm.** Health of the follower EC2; SG rules permitting UDP 1033/1034 + between nodes; the follower's own `minion` log (often "I did my part, the + leader never came back" — interplays with S2). +- **Fix.** Investigate/replace the follower EC2; open UDP 1033/1034 between + nodes if an SG change closed them. + +### S4 — Metering health flap (control plane; publisher-side) + +- **Symptom.** The metering pipeline emits **alternating `healthy`/`critical`** + for the same `ce_siteid` within minutes, while the EC2/CE stays up. Evidence is + the SQS records from the metering SNS topic (Reference C, §5.2). +- **Root cause.** Publisher-side: the metering service (SNS topic in + `700562448506`, consumed via SQS in `649897665836`) is producing flapping + health. **This is not a CE fault.** +- **Confirm.** Decode the envelope, list `status` over time per `ce_siteid`, + and check EC2 uptime across the same window. Note `ApproximateReceiveCount` + (redelivery can amplify the flap). +- **Fix.** Route to the metering service owner. **Do not deprovision the CE** on + the basis of the flap. + +### S5 — Stale healthcheck marker / stuck `expand vconfig` (on-host) + +- **Symptom.** Node reports `state: configuring, stage: "expand vconfig"` + indefinitely (`curl localhost:22222/provisioning-status` confirms); + `healthcheck.json` still set to `expand vconfig / configuring`. +- **Root cause.** An expansion failed catastrophically (usually **S2**). The + orchestration's success path sets the healthcheck back to + `completed / configured` (as it did on an earlier successful expansion at + e.g. `05:56:03`), but because PDE crashed mid-reconfigure, the **error path + never reached the completion step**. The healthcheck is a **stale marker**, not + a live operation. +- **Confirm.** The `minion` log: did the expansion actually complete, or error + before the completion line? Compare against a prior successful expansion's + completion entry. +- **Fix.** Recover the DB (S2) and re-run orchestration; or, once the system is + NORMAL, manually reset the healthcheck file. **Do not report the stuck stage as + the root cause** — it is downstream of the crash. + +### S6 — Config unmarshal failure / bad DynamoDB item (control plane) + +- **Symptom.** GCS logs `Error unmarshaling site`, then `unmarshal failed, + cannot unmarshal string set into Go value type map[string]string`, then + `Error creating compute engine config: error retrieving site : failed to + unmarshal site`. The CE never begins provisioning. +- **Root cause.** The site's DynamoDB item stores + `pooled_network_settings.allowed_accounts` / `allowed_cidrs` as **`SS` + (String Set)** while the Go struct expects **`M` (Map → `map[string]string`)**. + The read fails before any provisioning step runs. +- **Confirm.** `describe` the DynamoDB item for the site; check the attribute + type of `allowed_accounts` / `allowed_cidrs` (`SS` vs `M`). +- **Fix.** Either correct the stored item (`SS` → `M`), or change the Go field's + `dynamodbav` type to `[]string` to match an `SS`. This is a control-plane + **data/schema** fault, not an on-host failure. + +### Secondary noise — log errors that are usually NOT the root cause + +Catalog these so they don't hijack a triage. Each *can* matter, but each is +frequently a red herring — verify before blaming: + +- `cloud-init: Failed to fetch AWS instance tags via API: Unable to locate + credentials` — usually benign IMDS/timing during early boot. +- `disk: Command 'parted' failed: unrecognised disk label` — often a benign + first-boot disk-prep line. +- ServiceNow `Org not found` — an unrelated integration error. The textbook case + of "logged an error but wasn't on the critical path" (the actual cause was the + S1 PrivateLink timeout). + +--- + + +## 7. Bundled scripts + +These exist because the box has **no `jq` and no network**, the JSON runs ~40 MB, +and the syslog is too long to read. They are pure-stdlib and offline. The agent +loads them only when a step needs them, so they cost nothing on a run that only +has a `messages` file. + +- **`scripts/parse_cloudwatch.py`** — stdlib-only CloudWatch JSON parser. + Handles dict-vs-string `@message`, skips bulk `List…` entries, and offers + views: `--timeline` (per-CE chronological events), `--errors` (ERROR/`fail` + lines), and `--metering` (decodes the triple-nested SQS→SNS→Message envelope, + flags `healthy/critical` flaps and high `ApproximateReceiveCount`). Filter to + one engine with `--ce `. + + ```bash + python3 scripts/parse_cloudwatch.py --ce CEAMGPSCTEAM0009R --timeline + python3 scripts/parse_cloudwatch.py --metering + ``` + +- **`scripts/triage_syslog.sh`** — one-command sweep of a `messages` / `minion` + log: greps the Reference C anchors, surfaces the candidate transition lines, + and prints the next command to `sed` a window around a chosen line number. + Filter to a node with `--ip `. + + ```bash + bash scripts/triage_syslog.sh --ip 10.0.2.201 + # then: bash scripts/triage_syslog.sh --window + ``` + +> These two scripts are described here so the workflow is complete; if they are +> not yet present in `scripts/`, generate them as a follow-up (both are short and +> stdlib/offline by design). + +--- + + +## 8. Caveats and honesty rules + +- **Account IDs are environment-specific.** The topology in Reference A is a + starting map; confirm against the ARNs in the actual logs. +- **Logs prove sequence, not always intent.** When the logs can't settle a + question (e.g. *why* AWS never verified the DNS), say so and name what to check + next (CloudTrail, the owning team) rather than guessing. +- **A stuck state is usually a symptom.** Especially `expand vconfig / configuring` + on top of a `DOWN/HARDSTOP` — chase the crash, not the marker. +- **Flag load-bearing assumptions for empirical testing.** If a conclusion hinges + on an edge case (a slot still detaching, a TXT still propagating), say it's + load-bearing and verify it directly rather than trusting the spec. +- **Separate "what failed" from "what merely logged an error"** in every writeup. + This is the habit that makes the analysis trustworthy to someone who wasn't in + the logs. diff --git a/skills/ce-log-triage/scripts/parse_cloudwatch.py b/skills/ce-log-triage/scripts/parse_cloudwatch.py new file mode 100644 index 0000000000..f0ded5e4bd --- /dev/null +++ b/skills/ce-log-triage/scripts/parse_cloudwatch.py @@ -0,0 +1,231 @@ +#!/usr/bin/env python3 +""" +parse_cloudwatch.py — offline parser for CloudWatch Logs Insights JSON exports +(logs-insights-results__NN_.json) used in CE log triage. + +Why this exists: the exports routinely run ~40 MB, `jq` is often absent on the +box, and the host frequently has no network. This script depends only on the +Python standard library so it runs anywhere `python3` does. + +Input shape: a JSON array of entries, each like + {"@timestamp": "...Z", "@message": } +`@message` is sometimes a structured dict (level/msg/ce_siteid/operation/...) +and sometimes a plain string. Both are handled. Bulk inventory entries such as +a "ListComputeEngineConfigs response" (big `items` array) are skipped. + +Views: + --timeline per-CE chronological events (default if no view is chosen) + --errors entries that errored (ERROR level, or fail/timeout in the text) + --metering decode the triple-nested SQS -> SNS -> Message envelope, then + flag healthy/critical flaps and high ApproximateReceiveCount + +Filter: + --ce keep only entries that mention this CE/site id anywhere + +Usage: + python3 parse_cloudwatch.py logs-insights-results__42_.json --ce CEAMGPSCTEAM0009R --timeline + python3 parse_cloudwatch.py logs-insights-results__43_.json --errors + python3 parse_cloudwatch.py metering.json --metering +""" + +import argparse +import json +import sys + +# Fields worth surfacing from a structured @message, in display order. +INTEREST = ["operation", "status", "connectivity", "error_code", "stage", + "state", "ce_siteid", "config_id", "compute_engine_config_id"] + + +def load_entries(path): + """Load the top-level JSON array. Fail clearly if the file isn't that shape.""" + try: + with open(path, "r", encoding="utf-8", errors="replace") as fh: + data = json.load(fh) + except FileNotFoundError: + sys.exit(f"error: file not found: {path}") + except json.JSONDecodeError as exc: + sys.exit(f"error: {path} is not valid JSON ({exc}); is it a Logs Insights export?") + if isinstance(data, dict): # some exports wrap the array + data = data.get("results") or data.get("events") or [data] + if not isinstance(data, list): + sys.exit("error: expected a JSON array of {@timestamp,@message} entries") + return data + + +def as_message_dict(msg): + """Coerce @message to a dict when possible; return None if it's a plain string.""" + if isinstance(msg, dict): + return msg + if isinstance(msg, str): + s = msg.strip() + if s.startswith("{") and s.endswith("}"): + try: + parsed = json.loads(s) + return parsed if isinstance(parsed, dict) else None + except json.JSONDecodeError: + return None + return None + + +def is_bulk(msgd): + """True for inventory/list noise we never want in a timeline.""" + if not msgd: + return False + text = str(msgd.get("msg", "")) + if "ListComputeEngineConfigs" in text: + return True + count = msgd.get("count") + items = msgd.get("items") + if isinstance(count, int) and count > 50 and isinstance(items, list): + return True + return False + + +def mentions(entry, needle): + """Case-insensitive substring match over the whole stringified entry.""" + if not needle: + return True + return needle.lower() in json.dumps(entry, default=str).lower() + + +def ts_of(entry): + return entry.get("@timestamp", "") or "" + + +def fmt_fields(msgd): + parts = [] + for k in INTEREST: + if k in msgd and msgd[k] not in (None, ""): + parts.append(f"{k}={msgd[k]}") + return " ".join(parts) + + +def view_timeline(entries, needle): + rows = [] + for e in entries: + if not mentions(e, needle): + continue + msgd = as_message_dict(e.get("@message")) + if is_bulk(msgd): + continue + ts = ts_of(e) + if msgd is None: # plain-string @message + line = str(e.get("@message", "")).strip().replace("\n", " ") + rows.append((ts, f"{ts} [str] {line[:200]}")) + else: + level = msgd.get("level", "") + text = str(msgd.get("msg", "")).strip() + extra = fmt_fields(msgd) + rows.append((ts, f"{ts} [{level or '-'}] {text}" + (f" ({extra})" if extra else ""))) + rows.sort(key=lambda r: r[0]) + print(f"# timeline — {len(rows)} event(s)" + (f" matching {needle!r}" if needle else "")) + for _, line in rows: + print(line) + + +def view_errors(entries, needle): + hits = 0 + print("# errors — ERROR level or fail/timeout in the text" + + (f", matching {needle!r}" if needle else "")) + for e in sorted(entries, key=ts_of): + if not mentions(e, needle): + continue + msgd = as_message_dict(e.get("@message")) + blob = (json.dumps(msgd) if msgd else str(e.get("@message", ""))).lower() + level = (msgd.get("level", "") if msgd else "").upper() + if level == "ERROR" or any(t in blob for t in ("fail", "error", "timed out", "timeout", "exception")): + ts = ts_of(e) + text = (str(msgd.get("msg", "")) if msgd else str(e.get("@message", ""))).strip() + extra = fmt_fields(msgd) if msgd else "" + print(f"{ts} [{level or 'str'}] {text[:200]}" + (f" ({extra})" if extra else "")) + hits += 1 + if not hits: + print("(none)") + + +def _account_of(arn): + """ARN field 4 (0-based) is the account id: arn:aws:svc:region:ACCOUNT:...""" + parts = str(arn).split(":") + return parts[4] if len(parts) > 4 else "?" + + +def view_metering(entries, needle): + print("# metering — decoded SQS -> SNS -> Message envelope" + + (f", matching {needle!r}" if needle else "")) + per_ce = {} # ce_siteid -> list of (ts, status) + redeliveries = [] # (ts, ce, count) + rows = 0 + for e in sorted(entries, key=ts_of): + if not mentions(e, needle): + continue + msgd = as_message_dict(e.get("@message")) + if not msgd: + continue + sqs = msgd.get("sqsEvent") or msgd.get("Sqs") or {} + records = sqs.get("Records") if isinstance(sqs, dict) else None + if not records: + continue + ts = ts_of(e) + for r in records: + try: + attrs = r.get("attributes", {}) or {} + sender = attrs.get("SenderId", "?") + recv = int(attrs.get("ApproximateReceiveCount", "1")) + src_arn = r.get("eventSourceARN", "") + body = r.get("body") + body = json.loads(body) if isinstance(body, str) else (body or {}) + topic = body.get("TopicArn", "") + inner = body.get("Message") + inner = json.loads(inner) if isinstance(inner, str) else (inner or {}) + ce = inner.get("ce_siteid", "?") + status = inner.get("status", "?") + except (ValueError, AttributeError, KeyError) as exc: + print(f"{ts} [decode-skip] {exc}") + continue + print(f"{ts} ce={ce} status={status} recv={recv} " + f"sender={sender} queue_acct={_account_of(src_arn)} topic_acct={_account_of(topic)}") + per_ce.setdefault(ce, []).append((ts, status)) + if recv > 1: + redeliveries.append((ts, ce, recv)) + rows += 1 + if not rows: + print("(no metering/SQS records found)") + return + print("\n## per-CE status sequence (flap detection)") + for ce, seq in per_ce.items(): + statuses = {s for _, s in seq} + flap = " <-- FLAP (both healthy and critical)" if {"healthy", "critical"} <= statuses else "" + order = " -> ".join(s for _, s in seq) + print(f" {ce}: {order}{flap}") + if redeliveries: + print("\n## redeliveries (ApproximateReceiveCount > 1)") + for ts, ce, n in redeliveries: + flag = " <-- high" if n >= 4 else "" + print(f" {ts} {ce} recv={n}{flag}") + + +def main(): + ap = argparse.ArgumentParser(description="Offline CloudWatch Logs Insights JSON parser for CE triage.") + ap.add_argument("file", help="path to logs-insights-results__NN_.json") + ap.add_argument("--ce", metavar="ID", help="filter to entries mentioning this CE/site id") + ap.add_argument("--timeline", action="store_true", help="chronological event timeline") + ap.add_argument("--errors", action="store_true", help="error / failure / timeout entries") + ap.add_argument("--metering", action="store_true", help="decode metering SQS->SNS->Message, flag flaps") + args = ap.parse_args() + + entries = load_entries(args.file) + print(f"# loaded {len(entries)} entries from {args.file}\n") + + if args.errors: + view_errors(entries, args.ce) + print() + if args.metering: + view_metering(entries, args.ce) + print() + if args.timeline or not (args.errors or args.metering): + view_timeline(entries, args.ce) + + +if __name__ == "__main__": + main() diff --git a/skills/ce-log-triage/scripts/triage_syslog.sh b/skills/ce-log-triage/scripts/triage_syslog.sh new file mode 100644 index 0000000000..0f6834a4a7 --- /dev/null +++ b/skills/ce-log-triage/scripts/triage_syslog.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash +# triage_syslog.sh — one-command sweep of a Teradata `messages` or Salt `minion` +# syslog for CE triage. These files run 40k+ lines and viewers truncate the +# middle, so this greps the high-signal anchors (with line numbers), groups them, +# and then lets you open a window around any line. +# +# Pure grep/sed/awk — no dependencies beyond a POSIX shell. Read-only on input. +# +# Usage: +# bash triage_syslog.sh # full anchor sweep +# bash triage_syslog.sh --ip 10.0.2.201 # sweep + a section of lines for that node +# bash triage_syslog.sh --window 36750 # print lines ~around 36750 (context) +# +# Workflow: run the sweep, find the transition line (where state changed) in the +# output, then re-run with --window to read the surrounding +# sequence. + +set -u + +FILE="${1:-}" +if [ -z "$FILE" ] || [ ! -f "$FILE" ]; then + echo "usage: bash triage_syslog.sh [--ip ] [--window ]" >&2 + exit 2 +fi +shift || true + +IP="" +WINDOW="" +while [ $# -gt 0 ]; do + case "$1" in + --ip) IP="${2:-}"; shift 2 ;; + --window) WINDOW="${2:-}"; shift 2 ;; + *) echo "unknown arg: $1" >&2; exit 2 ;; + esac +done + +# ---- window mode: just show context around a line and exit ------------------ +if [ -n "$WINDOW" ]; then + if ! printf '%s' "$WINDOW" | grep -qE '^[0-9]+$'; then + echo "--window expects a line number" >&2; exit 2 + fi + CTX=40 + START=$(( WINDOW > CTX ? WINDOW - CTX : 1 )) + END=$(( WINDOW + CTX )) + echo "== context: lines ${START}-${END} (around ${WINDOW}) of ${FILE} ==" + sed -n "${START},${END}p" "$FILE" + exit 0 +fi + +TOTAL=$(wc -l < "$FILE" | tr -d ' ') +echo "== ${FILE} : ${TOTAL} lines ==" +echo " (find the transition line below, then: bash triage_syslog.sh ${FILE} --window )" + +# Helper: titled, line-numbered grep for an extended regex, capped for sanity. +group() { + local title="$1" regex="$2" cap="${3:-40}" + echo + echo "--- ${title} ---" + grep -nE "$regex" "$FILE" 2>/dev/null | head -n "$cap" || true +} + +group "DBS / PDE state" "HARDSTOP|DOWN/HARDSTOP|DOWN/TDMAINT|PDE is not operational|Cannot open PDE device" +group "Reconfigure / fatal events" "Event 13912|Event 13895|failed reconcile|run_tpareconfig|tpareconfig|is_normal|persistently failing" +group "vconfig / healthcheck" "Vconfig GDO|vconfig|expand vconfig|expand|healthcheck" +group "BYNET" "BYNET|lost contact|eth0-udp-1033|eth0-udp-1034" +group "Salt orchestration" "salt-master|salt-minion|tdinfo|vprocmanager|node_num|retcode 61" +group "Autoscaler / scale" "ce-autoscaler|scale-up|scale_up|sustained" + +# Optional: a dedicated section of lines mentioning a specific node IP. This is +# additive (it does NOT filter the groups above), because key events like +# "Event 13912" often don't carry the node IP. +if [ -n "$IP" ]; then + echo + echo "--- lines mentioning node ${IP} ---" + grep -nF "$IP" "$FILE" 2>/dev/null | head -n 60 || true +fi + +# Known-noise section, called out separately so it isn't mistaken for the cause. +echo +echo "--- known secondary noise (verify before blaming) ---" +grep -nE "Unable to locate credentials|unrecognised disk label|unrecognized disk label|Org not found" "$FILE" 2>/dev/null | head -n 20 || true diff --git a/skills/rca-writeup/SKILL.md b/skills/rca-writeup/SKILL.md new file mode 100644 index 0000000000..01dd20bddf --- /dev/null +++ b/skills/rca-writeup/SKILL.md @@ -0,0 +1,480 @@ +--- +name: rca-writeup +description: > + Turn a COMPLETED log/incident investigation into a structured, shareable + root-cause document. Use this skill whenever an analysis has reached a + conclusion and the user wants it written up — triggers include "write this + up", "draft an RCA", "write a postmortem", "incident report", "document this + for the ticket", "summarize the root cause for the team / for my manager", or + any request to make a finding legible to people who were not in the logs. + It is the natural second step after the `ce-log-triage` skill: that skill + reaches the conclusion, this skill formats it, so offer it proactively the + moment a triage lands on a cause. Reach for it even when the user does not say + the word "RCA" — if they have a root cause and an audience, this is the skill. + Two hard boundaries: (1) this skill does NOT perform the investigation — if the + analysis is not actually finished, do not invent a root cause; say what is + still missing and offer to run `ce-log-triage` first. (2) Never fabricate + identifiers, timestamps, or evidence to make the document look complete; a + precise "the logs cannot prove this" is the house style, a confident guess is + not. Applies to Teradata Compute Engine (CE) failures and the surrounding AWS + infrastructure (PrivateLink/DNS, EKS/Velero restores, DynamoDB, ECS, + networking, on-host PDE/TPA/Salt), and the template generalizes to any infra + incident. +license: internal +--- + +# RCA Writeup + +Strong forensic work is worthless if it evaporates in a chat window. The person +who has to approve the fix, the teammate who owns the upstream service, the +manager who needs the one-paragraph version — none of them were in the logs with +you. This skill exists to convert a finished investigation into a document that +serves all of them: a verdict the manager can skim, a timeline an engineer can +audit, and a remediation list the on-call can act on. It is the artifact that +makes the depth of the analysis *visible*. + +This skill is the formatting half of a pair. The **`ce-log-triage`** skill does +the investigation — it reads the CloudWatch JSON or the `messages`/`minion` +syslog, walks the state machine, and identifies the root cause. **`rca-writeup`** +takes those findings and renders them in the house style below. Run them in +sequence: triage to reach the conclusion, then "write this up" to get the +document. Do not duplicate the investigation here; consume its output. + +--- + +## Table of contents + +1. [When to use — and when not to](#when-to-use) +2. [Input contract: what a finished investigation must hand over](#input-contract) +3. [The output template (use this exact structure)](#the-template) +4. [House-style voice and conventions](#house-style) +5. [How to build the writeup from a finished triage](#how-to-build) +6. [Worked example 1 — PrivateLink DNS verification timeout (control plane)](#example-1) +7. [Worked example 2 — PDE crash → DOWN/HARDSTOP (on-host)](#example-2) +8. [Common mistakes to avoid](#mistakes) +9. [Output mechanics](#output-mechanics) +10. [Bundled resources](#bundled-resources) + +--- + + +## 1. When to use — and when not to + +**Use it when:** +- An investigation has reached a root cause (or a well-bounded "most likely" + cause with named evidence) and the user wants a document. +- The user says any of: write it up, RCA, postmortem, incident report, "for the + team/manager", "make this shareable", "document this for the ticket", + "summarize the findings". +- A `ce-log-triage` run has just concluded and the natural next move is to + capture it — offer the writeup without waiting to be asked. + +**Do NOT use it when:** +- The investigation is not finished. If there is no defensible root cause yet, + **stop and say so** — list what is still unknown and offer to run + `ce-log-triage`. A half-finished RCA that papers over the gap with a guess is + worse than no RCA. +- The user wants live analysis ("why did this fail?") — that is `ce-log-triage`. + +**Honesty rule that overrides formatting:** never invent an identifier, a +timestamp, an ARN, or an event to fill a slot in the template. If the timeline +has a gap, show the gap. If ownership is unproven, say "owner unconfirmed — +verify in CloudTrail for account X". The credibility of the whole document rests +on every concrete claim being real. This skill applies most often to CE +failures, but the same structure fits an EKS/Velero restore, a DynamoDB schema +fault, or any infra incident — the conventions are general even though the +bundled examples are CE-shaped. + +--- + + +## 2. Input contract: what a finished investigation must hand over + +Before writing, confirm you have these. If something is missing, ask for it or +mark it explicitly as unknown in the document — do not paper over it. + +- **Identity:** CE ID (e.g. `CEAMGPSCTEAM0009N`), site ID (e.g. + `TDICAM53386PP80`), environment (preprod/prod/sit), region/AZ, account ID. +- **The reported failure state** as observed (`provisioning_failed`, + `down/hardstop`, `PRIVATE_LINK_DEPLOY: FAILED`, `NOT_PROVISIONED`, …). +- **A UTC timeline** of the load-bearing events, each with the evidence that + supports it (a log line, an event number, an error code). +- **The root cause** — the single thing that, had it not happened, would have + prevented the failure — plus its deciding evidence. +- **Secondary issues** observed but off the critical path. +- **The owning account/service** for the fault, if determined. +- **Open questions** the logs could not settle. + +This is exactly the shape `ce-log-triage` produces, which is why they compose. + +--- + + +## 3. The output template (use this exact structure) + +ALWAYS produce the document in this order. Sections marked *(optional)* may be +omitted when there is nothing real to put in them — but never delete a section +just to hide a gap; if it's relevant and unknown, keep it and write "unknown". + +```markdown +# RCA: — + +| Field | Value | +|---|---| +| CE ID | CEAMGPSCTEAM0009N | +| Site ID | TDICAM53386PP80 | +| Environment | preprod | +| Region / AZ | us-west-2 / usw2-az2 | +| Account | 164607045827 | +| Severity | | +| Status | Investigating · Identified · Mitigated · Resolved · Monitoring | +| Window (UTC) | 2026-05-28 07:22 – 07:48 | +| Author | | + +## Summary +One or two sentences: the verdict. The reader who only reads this line should +walk away knowing what failed and why. + +## Impact +What was affected, for whom, for how long. (For a single stuck CE this may be a +single line; for a fleet-wide event, quantify it.) + +## Timeline (UTC) +| Time (UTC) | Event | What it proves | +|---|---|---| +| 07:22:39 | … | … | +Each row pairs an event with its significance — not just "what the log said" but +"what it establishes". Normalize every timestamp to UTC. + +## Root cause +State it plainly in one or two sentences, then give the deciding evidence +(the exact error code / event number / log location). No hedging once the +evidence supports the verdict. + +## Supporting evidence (optional, if not already clear from the timeline) +The specific lines/codes that pin the root cause — quoted or cited exactly. + +## Contributing factors (optional) +Conditions that made the failure more likely or worse but were not the trigger +(e.g. an aggressive timeout, sustained CPU before a scale-up). + +## Secondary issues +Real problems observed in the logs that did NOT cause this failure. Keep them +visibly separate from the root cause so no one mistakes a logged-but-benign +error for the trigger. + +## Recommended next steps +Ordered by authority of evidence: confirm in the authoritative source first +(e.g. CloudTrail in the owning account), then resolve the specific role/ARN, +then "ask the owning team" only when the logs can't settle it. Each step is +actionable; name an owner where known. + +## Caveats — what the logs cannot prove +The honest limits. Any conclusion that rests on a load-bearing assumption the +logs can't fully prove is flagged here with where to verify it. + +## Appendix (optional) +Key raw excerpts, ARNs, IDs, code locations — for the engineer who wants to +re-walk the evidence. +``` + +--- + + +## 4. House-style voice and conventions + +These are the things that make a writeup *trustworthy*, and exactly the things a +generic model flattens. They are not decoration — each one is load-bearing. + +- **Name exact identifiers.** Account IDs, ARNs, `vpce-svc-…`/`vpc-…`/`subnet-…` + IDs, error codes (`AWS-AssignSlot-Error`), event numbers (`Event 13912`), + retcodes (`retcode 61`), CE/site IDs, code locations (`ce_manager.go:122`), + the actual TXT-record name. Never write "a permissions error" when the log + gives you the code; never write "the network service" when you can name the + account. Specificity is what lets a reader verify you. + +- **Distinguish "what failed" from "what merely logged an error."** This is the + single most important discipline. A failure log is noisy; most error lines did + not cause anything. Put the cause in *Root cause* and everything else in + *Secondary issues*, and say which is which in plain words. + +- **Timestamps are precise and in UTC.** Logs from different services carry + different local offsets; normalize to UTC immediately and label it. A timeline + in mixed offsets silently lies. + +- **State the verdict plainly; hedge only where evidence runs out.** Once the + evidence supports the root cause, say it flatly ("Root cause: VPC endpoint + service private DNS verification timed out"). Save the hedging for genuine + unknowns, and put those in *Caveats*, not smeared through the verdict. + +- **Flag load-bearing assumptions for empirical testing.** When a conclusion + hinges on something the logs can't fully prove — cross-account behavior only + visible in CloudTrail, a TXT record's actual propagation, a slot still + detaching — say it's load-bearing and point to where to confirm it, rather + than trusting the spec. + +- **Name the owning account/service.** Every state transition lives in a specific + service in a specific account; naming the owner is what turns an analysis into + an actionable ticket. + +- **Write for two readers at once.** A manager reads *Summary → Impact → Next + steps* and stops. An engineer reads *Timeline → Root cause → Appendix*. Order + and phrase the document so the skim path and the deep path both work. + +- **Severity and status are explicit.** Use the org's severity scale (don't + invent one); set status to one of Investigating / Identified / Mitigated / + Resolved / Monitoring so the reader knows how settled this is. + +--- + + +## 5. How to build the writeup from a finished triage + +A short procedure for turning triage output into the document above: + +1. **Fill the header first.** Pull identity, environment, region, account, and + the UTC window straight from the triage. This frames everything. +2. **Write the Summary last but place it first.** The cleanest verdict sentence + is usually obvious only after the timeline is laid out — draft it once the + root cause is fixed, then put it at the top. +3. **Lift the timeline and add the "what it proves" column.** The triage already + has the ordered events; the value you add here is the significance of each — + the column that turns a log dump into an argument. +4. **State the root cause in one sentence, then cite the deciding line.** If the + evidence isn't self-evident from the timeline, add the *Supporting evidence* + subsection. +5. **Quarantine the noise.** Move every logged-but-benign error to *Secondary + issues* with an explicit "did not cause / did not block" note. +6. **Order remediation by authority.** Authoritative source (CloudTrail, the + owning service's own log) → resolve the specific role/ARN → ask the owning + team. Attach an owner to each step where known. +7. **Write the caveats honestly.** Name what the logs can't prove and the + concrete check that would settle it. This section is what makes the rest + believable. + +--- + + +## 6. Worked example 1 — PrivateLink DNS verification timeout (control plane) + +This is the canonical example: a control-plane failure where the root cause is +clean, the secondary issue (a ServiceNow "Org not found") is real but off the +critical path, and the conclusion carries honest caveats. Study how identifiers +are named exactly and how the secondary issue is kept separate. + +```markdown +# RCA: PrivateLink deploy failed — private DNS verification timeout — CEAMGPSCTEAM0009N + +| Field | Value | +|---|---| +| CE ID | CEAMGPSCTEAM0009N (tisan-standard-ce-opt-issue-recreate-001) | +| Site ID | TDICAM53386PP80 | +| Environment | preprod | +| Region / AZ | us-west-2 / usw2-az2 | +| Account | 164607045827 | +| Severity | SEV3 (single CE, no customer impact) | +| Status | Identified | +| Window (UTC) | 2026-05-28 07:22:39 – 07:48:20 | +| Author | | + +## Summary +Provisioning failed because the VPC endpoint service's **private DNS +verification timed out**. The operation `PRIVATE_LINK_DEPLOY` returned +`AWS-AssignSlot-Error` after the system waited ~10 minutes for AWS to verify +domain ownership and the verification never completed. + +## Impact +One CE (`CEAMGPSCTEAM0009N`) left in `NOT_PROVISIONED` with connectivity +`FAILED`. No customer-facing impact; this was a recreate/test CE. + +## Timeline (UTC) — 2026-05-28 +| Time | Event | What it proves | +|---|---|---| +| 07:22:39 | POST to create the private link for site `TDICAM53386PP80` / CE `CEAMGPSCTEAM0009N` (initiated by `gg5338630` via a TD-Ops service-account role; allowed accounts `649897665836`, `862579450314`; DEDICATED, 1X) | Provisioning request accepted; config is well-formed | +| 07:22:39 | Metadata service registered the config, granted IDP access, called the network service — and ServiceNow returned **400 "Org not found"** for org `GPSCTEAM` | A secondary CMDB-sync failure occurred here; it did **not** block the private-link flow | +| 07:22:55 | Network service found no existing slot, created a new NLB `TDICAM53386PP80-046a7c493335-nlb` in `vpc-0c775cb134c335152`, `subnet-09f9d4323310cbdc7` | Network setup progressed normally | +| 07:25:53 | Allowed accounts updated on endpoint service `vpce-svc-0ae02c5903baed7d7`; private DNS enabled for `ceamgpscteam0009n.ce.preprod.qateradatacloud.com` | Endpoint service configured; DNS step begins | +| 07:25:54 | TXT record created (`_tk7bmpatocjfca1qvfem` → `vpce:0geVaDIWve7gV74ULWEh`) to prove domain ownership | The ownership-proof record was written | +| 07:26:00 | Began waiting for AWS private DNS verification (AWS looks up the TXT record) | The AWS-side check started | +| 07:36:03 | After ~10 min, **timed out**; error raised from `ce_manager.go:122`; status set `FAILED`, metadata patched | The verification window elapsed without success — the failure point | +| 07:36:04 | Status record `PRIVATE_LINK_DEPLOY: FAILED`; PATCH to metadata returned 200 | Failure recorded cleanly downstream | +| 07:36:20–07:48:20 | Periodic GET polls (~30–60s) for the CE config returned `NOT_PROVISIONED` / connectivity `FAILED` | The CE settled into the failed terminal state; nothing retried it | + +## Root cause +AWS never completed **private DNS domain-ownership verification** for the +endpoint service within the ~10-minute window (07:26:00 → 07:36:03), so slot +assignment failed with `AWS-AssignSlot-Error`, raised from `ce_manager.go:122`. + +## Contributing factors +- The verification window is ~10 minutes, which is tight for AWS private DNS + verification — under regional load or with a high-TTL/complex delegation chain, + propagation can exceed it. + +## Secondary issues +- **ServiceNow `Org not found` (400) for org `GPSCTEAM`** at 07:22:39. This means + the CE was not tracked in ServiceNow's CMDB — an operational blind spot and a + metadata↔ServiceNow data-sync problem. It is **not** related to the DNS + timeout and did not block provisioning. + +## Recommended next steps +1. Verify the TXT record `_tk7bmpatocjfca1qvfem.ceamgpscteam0009n.ce.preprod.qateradatacloud.com` + actually resolves in the Route 53 hosted zone that serves + `ce.preprod.qateradatacloud.com` (confirm it's the correct zone, not a + sibling). — *Network Service owner, acct 656901843610* +2. If the record is correct and the zone is right, increase the DNS verification + timeout in `ce_manager.go` and retry the deployment. +3. Fix the ServiceNow org mapping for `GPSCTEAM` to stop future CMDB-sync gaps. + +## Caveats — what the logs cannot prove +The logs show the timeout but not *why* AWS didn't verify. The three live +hypotheses — DNS propagation delay, wrong hosted zone, or too-aggressive timeout +— are not distinguishable from these logs alone. Confirm by checking actual TXT +resolution against the hosted zone before assuming the timeout value is the +problem; that assumption is load-bearing. +``` + +Note what this example does: every ARN/ID is exact, the ServiceNow error is +quarantined in *Secondary issues* with an explicit "did not block", and the +*Caveats* section refuses to pick among the three causes the logs can't separate. + +--- + + +## 7. Worked example 2 — PDE crash → DOWN/HARDSTOP (on-host) + +The on-host layer. Here the timeline is the star — the failure is a precise +chain of events on the node, and the root cause is a reconcile failure during an +expansion. Note how the stuck "configuring/expand vconfig" marker is correctly +framed as a *downstream symptom*, not the cause. + +```markdown +# RCA: Database DOWN/HARDSTOP after failed online reconfiguration — + +| Field | Value | +|---|---| +| CE ID | | +| Environment | | +| Severity | SEV2 (database down, not self-recovering) | +| Status | Identified | +| Window (UTC) | 06:40 – 07:21 | +| Author | | + +## Summary +An autoscaler-driven node expansion triggered an online reconfiguration that +**failed to reconcile** (PDE Event 13912). PDE forced a TPA restart (Event +13895), the database went **DOWN/HARDSTOP**, and it never recovered. + +## Impact +Database unavailable from 06:44:23 onward; the node remained stuck reporting +`expand vconfig / configuring` because the orchestration's completion step was +never reached. + +## Timeline (UTC) +| Time | Event | What it proves | +|---|---|---| +| 06:40:47 | `ce-autoscaler` triggered a scale-up after sustained CPU (~85–91%) | The expansion was demand-driven, not spurious | +| 06:43:16 | `state.sls expand vconfig` ran; "2408 bytes successfully written to Vconfig GDO"; healthcheck → `stage:"expand vconfig", state:"configuring"` | The vconfig write succeeded; the operation was underway | +| 06:43:19 | `tdops.run_tpareconfig` set `tosstate RECONFIG`, ran `/usr/pde/bin/tpareconfig` (reported success) | Reconfigure was invoked | +| 06:43:22 | `wait_normal_system_state` poll #1 → `is_normal=False` | Expected post-reconfigure settling | +| 06:43:23 | **PDE Event 13912: "Node needed for online reconfiguration failed reconcile"** → **Event 13895: forced TPA restart** | The reconcile failed — the trigger of the outage | +| 06:43:27 | `/usr/pde/bin/tosstate: PDE is not operational - Cannot open PDE device` (repeats 12× at 5s) | PDE had crashed, not merely "still settling" | +| 06:44:22 | `run_tpareconfig` gave up: "tosstate persistently failing after 12 attempts while waiting for NORMAL" | The orchestration abandoned recovery | +| 06:44:23 | **DBS → DOWN/HARDSTOP** | The database went down and stayed down | +| 06:44:35+ | Retry cycles failed: `tdinfo: can't find node_num 34, byn001-02, in vconfig GDO`; `vprocmanager: PDE is down ... Operation not permitted (retcode 61)` | The GDO did not yet include the new node; retries couldn't proceed | + +## Root cause +The new follower node could not reconcile with the leader during the online +reconfiguration (PDE **Event 13912**) — most likely because the **BYNET was +still processing the detachment of a previously decommissioned node at the same +slot**, and the **vconfig GDO had not yet been updated** to include the new node +(`node_num 34, byn001-02` is reported missing). The reconcile failure forced a +TPA restart, which produced a DOWN/HARDSTOP the system never recovered from. + +## Secondary issues +- The stuck `expand vconfig / configuring` state is a **downstream symptom**, not + a cause: the orchestration's success path (which resets the healthcheck to + `completed/configured`, as it did on the earlier successful expansion at + 05:56:03) was never reached because PDE crashed mid-reconfigure. + +## Recommended next steps +1. Recover the **leader database first** — DOWN/HARDSTOP does not self-heal. +2. Verify the slot/`node_num 34` is clean (the prior decommission has fully + detached on BYNET) before re-running the expansion. +3. Re-run the expansion orchestration once the system is NORMAL; confirm the + healthcheck returns to `completed/configured`. + +## Caveats — what the logs cannot prove +The reconcile failure's precise cause (slot still detaching vs. GDO update +ordering) is inferred from the missing `node_num` and the timing; confirm +against the leader's reconfigure logs and the decommission record for that slot. +This is the load-bearing assumption — verify it before re-adding the node. +``` + +--- + + +## 8. Common mistakes to avoid + +- **Burying the verdict.** The root cause belongs in the *Summary*'s first + sentence, not discovered three sections in. +- **Merging secondary noise into the root cause.** The ServiceNow "Org not + found" and the stuck `expand vconfig` marker are the textbook traps — both are + real, neither is the cause. Keep them in *Secondary issues*. +- **Fabricating to fill the template.** An empty slot is fine; an invented ARN or + timestamp destroys trust in every other claim. If it's unknown, say "unknown". +- **Vague identifiers.** "a permissions error", "the network service", "around + 7am" — replace with the code, the account, the UTC timestamp. +- **Local timestamps or mixed offsets.** Always UTC, always labeled. +- **Over-confident causes the logs can't support.** Put genuine uncertainty in + *Caveats* with a concrete way to resolve it; don't smear hedges through the + verdict. +- **Writing only for the engineer (or only for the manager).** Serve both paths. + +--- + + +## 9. Output mechanics + +- **Default to Markdown**, written to a file named + `rca--.md` (e.g. `rca-CEAMGPSCTEAM0009N-2026-05-28.md`). + Markdown drops cleanly into Slack, Confluence, a GitHub issue, or a ticket, + which is where these documents actually live. +- For a **formal or executive deliverable**, the same Markdown can be rendered to + `.docx` or `.pdf` on request — but Markdown is the default; don't reach for a + heavier format unless the user signals they need one. +- Keep the **metadata header table** at the very top; it makes the document + legible at a glance and is good postmortem hygiene. +- If the investigation produced raw log excerpts worth preserving, put them in + the *Appendix*, not inline in the timeline (which should stay scannable). + +--- + + +## 10. Bundled resources + +- `references/rca-example-privatelink-timeout.md` — the gold-standard worked + example (the CEAMGPSCTEAM0009N case in Section 6), kept as a standalone + reference. Handing the agent a real past writeup anchors output to this + standard far better than abstract rules. +- `references/rca-example-hardstop.md` — the on-host DOWN/HARDSTOP example + (Section 7), for the node-layer shape. +- `references/rca-template.md` — the bare template from Section 3, ready to copy. + +> These references are described here so the skill is complete on its own; if +> they are not yet present in `references/`, generate them as a follow-up (each +> is just the corresponding section extracted to its own file, lightly scrubbed +> of any sensitive identifiers). The skill works from the inlined versions above +> either way. Real past writeups in your own voice are the most effective anchor, +> so prefer adding one or two of your actual RCAs here over relying on the +> synthetic template alone. + +--- + +## Composition note + +`ce-log-triage` → `rca-writeup` is the intended pipeline: triage produces the +findings (summary, UTC timeline, root cause, secondary issues, next steps, +caveats), and this skill renders them in the house style. If you arrive here +without those findings, return to `ce-log-triage` first rather than guessing — +the quality of the document is capped by the quality of the investigation behind +it.