/remote-gateway:gateway-logsfrom remote-gateway
Diagnose problems from a ByteDesk remote gateway's own log index with the gateway `logs` plugin: find the right logger, query by time window, level, text or correlation id, tail live, line logs up with an incident, export an NDJSON evidence slice, and mute a noisy logger reversibly. Use this whenever something on a gateway host misbehaves — errors, 5xx, a plugin that will not start, a crash or restart loop, slow requests, an agent session that died, "what happened at 03:27", "check the gateway logs", "tail the logs", "why is the log store full", "this logger is spamming" — and before guessing at a cause, even when the user does not say "logs". Covers the MCP tools `logs_list_loggers`, `logs_query`, `logs_get`, `logs_stats`, `logs_get_storage`, `logs_set_storage`, `logs_export`, `logs_mute_logger`, `logs_unmute_logger`, `logs_flush_now`, and the HTTP API `/logs/api/*`. For CPU, memory or goroutine questions use gateway-profiling next.
Ships in remote-gateway. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
The gateway keeps its own searchable log index: an in-memory ring plus SQLite
segments, one logger per plugin or host subsystem (kernel, access,
terminal-runtime, …). It is faster and better filtered than journalctl.
Read it before you form a theory, and quote the records you used as evidence.
Never print, log or paste a token, cookie value or password. Log records can contain secrets the redactor missed; when you copy evidence, drop or mask any value that looks like a credential.
Use the first route that works.
A. MCP tools. If logs_stats is in your tool list (often as
mcp__bytedesk-gateway__logs_stats), call the tools directly. They come from
the running gateway's MCP endpoint (http://127.0.0.1:8757/mcp), which only
accepts an operator API token as a Bearer. The stand-alone stdio
mcp-gateway subcommand in the per-session generated config does not carry
the plugin tools, so do not expect logs_* there.
B. HTTP API. Otherwise log in with the remote-gateway-login skill and
reuse its cookie jar. It reads ~/.bytedesk/remote-gateway/agent-login.yaml
and prints JSON with url and cookieJar; it never prints the password.
LOGIN="${CLAUDE_PLUGIN_ROOT:-<remote-gateway plugin dir>}/skills/remote-gateway-login/scripts/login.sh"
OUT=$(bash "$LOGIN") || { echo "$OUT"; exit 1; } # stop on exit 2-5; see remote-gateway-login
U=$(jq -r .url <<<"$OUT"); J=$(jq -r .cookieJar <<<"$OUT")
gw() { curl -sS --fail-with-body -m 30 -b "$J" "$U$@"; } # gw /logs/api/stats
Shell state does not survive between Bash calls, so run this block at the start
of every call that uses gw. Rerunning is cheap: the login script reuses a
valid cookie and sends no password.
For another host, pass that gateway's --url --method --username --password
to the login script, or use the infrastructure repo's infra run <service> --
when the registry has an entry for it. A 401 means log in again; do not build
your own login request.
| MCP tool | HTTP equivalent |
|---|---|
logs_stats | GET /logs/api/stats |
logs_list_loggers | GET /logs/api/loggers |
logs_query | GET /logs/api/query?… |
logs_get (correlation id) | GET /logs/api/query?correlation_id=… |
| (tail, HTTP only) | GET /logs/api/tail?… (server-sent events) |
logs_export | GET /logs/api/export?… (NDJSON) |
logs_get_storage / logs_set_storage | GET / PUT /logs/api/storage |
logs_mute_logger / logs_unmute_logger | POST /logs/api/mute {"logger":"x","muted":true|false} |
logs_flush_now | POST /logs/api/flush |
Filter parameters (MCP arguments, or HTTP query string):
logger, tree (exact | deps = plus what it requires | callers = plus
plugins that depend on it), levels (HTTP: level=ERROR,WARN), text
(case-insensitive substring), correlation_id, since / until (RFC3339 or
unix ms), limit (MCP: default 50, maximum 500; HTTP query: default 200, maximum
5000; HTTP export: up to 5000; logs_get: default 100). Check timestamps rather than
assuming the order of returned records.
ingestEnabled from
logs_get_storage (HTTP: .settings.ingestEnabled in /logs/api/stats),
and suppressedRows and mutedDrops from logs_stats (HTTP: .stats).
If ingest is off or lines were suppressed or muted, say so: missing logs
are a finding, not proof that nothing happened.logs_list_loggers shows counts, suppressed counts,
last activity and muted state. A logger whose last time stops at the
incident points at the component that stopped. A high suppressed count
means rate limiting hid lines.levels=["ERROR","WARN"], then widen to INFO around
the first error.tree=deps (something it needs failed) or
tree=callers (who was calling it).correlation_id from an error record and
fetch every record with it (logs_get). That is the cross-plugin story of
one request.curl -sS -N -m 60 -b "$J" "$U/logs/api/tail?logger=kernel&level=ERROR,WARN".
The stream closes after 55 seconds whatever the activity; reconnect with
since= set to the last record's time.logs_flush_now drains the ring to disk. It is
safe and changes no settings.Say what the logs show, the first bad record, and what it implies. Then go to gateway-profiling for CPU, memory, lock or goroutine symptoms, or to the fix.
Export the slice you relied on, not the whole store:
: "${EVIDENCE_DIR:?set EVIDENCE_DIR first}"; mkdir -p "$EVIDENCE_DIR"
gw "/logs/api/export?logger=kernel&level=ERROR,WARN&since=2026-10-05T03:20:00-04:00&until=2026-10-05T03:40:00-04:00" \
> "$EVIDENCE_DIR/gateway-logs-kernel.ndjson"
EVIDENCE_DIR is the task's evidence folder, the incident runbook entry or the
playbook the caller named. Record the exact filter beside the file so another
agent can re-run it. Mask credential-looking values before attaching it.
logs_list_loggers first
and name the logger exactly. Muting drops that logger's lines at ingest, so
you lose its evidence until you unmute; the drop count stays in stats.
Confirm with the requester on a production host, record why, then
logs_mute_logger {"logger":"x"}. Undo with logs_unmute_logger. Prefer
fixing the noise at its source and unmute once that ships.logs_set_storage, PUT /logs/api/storage). Read
logs_get_storage first and keep the old JSON as the rollback. Lowering
retention or size caps deletes history permanently — that is destructive;
get explicit confirmation. Changes apply on the next flush, with no restart.logs_stats, logs_list_loggers) and
report what you observed.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub bytedeskai/bytedesk-marketplace --plugin remote-gateway17 skills in this plugin
/commitCommit and push repo changes with human-only authorship, Keep a Changelog update, and embedded changelog sync. After a successful commit in a linked git worktree, offer to merge into the main checkout and remove the tree (Grok/Claude/Codex isolation). Never attributes coding agents or external co-authors. Use when the user runs /commit, says "commit", "commit and push", "land the changes", "update changelog and push", or wants a clean push of the current worktree.
/cutoverSafe production cutover for bytedesk-remote-gateway via this skill's bundled scripts/deploy-safe.sh, only from the develop branch. DEFAULT always restarts: preflight → stage → restart-cutover → postflight (do not stage-only or ask for restart). Use FORCE_RESTART=1 when stage is UNCHANGED but bounce is still required. Also after every completed implementation task that changes gateway/SPA runtime. After feature cutover PASS, ask the operator to /commit (do not auto-commit). Triggers: /cutover, "safe cutover", "deploy-safe", "stage binary" (stage-only only if user says stage only / no restart), "restart cutover", FORCE_RESTART, postflight healthz.
/desktop-depsCheck desktop/agents profile dependencies for the gateway on Linux, macOS, and Windows. Use when desktop profile, VNC, Xvfb, or ttyd is missing.
/gateway-doctorDiagnose a ByteDesk gateway install without printing secrets. Use for doctor, health check, missing control.env, or post-install verification.
/gateway-installInstall ByteDesk remote gateway (commercial free core) on Linux, macOS, or Windows. Profiles core|agents|desktop. Use when the user says install gateway, setup gateway, or wants a private-first bytedesk-gateway home.
/gateway-lifecycleStart, stop, status, healthz, and print /setup URL for an installed ByteDesk gateway on Linux (systemd), macOS (launchd), or Windows (run.ps1/pid).