diff --git a/CLAUDE.md b/CLAUDE.md index c2432a0..c23f823 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -161,11 +161,27 @@ The **lab-monitoring** MCP server can query logs from Loki. All hosts ship syste - `host` - Hostname (e.g., `ns1`, `ns2`, `monitoring01`, `ha1`). Use this label, not `hostname`. - `systemd_unit` - Systemd unit name (e.g., `nsd.service`, `prometheus.service`, `nixos-upgrade.service`) -- `job` - Either `systemd-journal` (most logs) or `varlog` (file-based logs like caddy access logs) +- `job` - Either `systemd-journal` (most logs), `varlog` (file-based logs), or `bootstrap` (VM bootstrap logs) - `filename` - For `varlog` job, the log file path (e.g., `/var/log/caddy/nix-cache.log`) Journal log entries are JSON-formatted with the actual log message in the `MESSAGE` field. Other useful fields include `PRIORITY` and `SYSLOG_IDENTIFIER`. +**Bootstrap Logs:** + +VMs provisioned from template2 send bootstrap progress directly to Loki via curl (before promtail is available). These logs use `job="bootstrap"` with additional labels: + +- `host` - Target hostname +- `branch` - Git branch being deployed +- `stage` - Bootstrap stage: `starting`, `network_ok`, `vault_ok`/`vault_skip`/`vault_warn`, `building`, `success`, `failed` + +Query bootstrap status: +``` +{job="bootstrap"} # All bootstrap logs +{job="bootstrap", host="testvm01"} # Specific host +{job="bootstrap", stage="failed"} # All failures +{job="bootstrap", stage=~"building|success"} # Track build progress +``` + **Example LogQL queries:** ``` # Logs from a specific service on a host