Enable Firecracker logging and metrics (named pipes, FlushMetrics) and set up guest-host communication over vsock

domain: github.com/firecracker-microvm/firecracker · 9 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Logger: create the backing resource first (`mkfifo logs.fifo` or `touch logs.file`), then configure ONCE: `curl --unix-socket /tmp/firecracker.socket -X PUT http://localhost/logger -d '{"log_path": "logs.fifo", "level": "Warning", "show_level": false, "show_log_origin": false}'` — or at startup via `--log-path logs.fifo --level Error --show-level --show-log-origin`.
  2. Metrics: `mkfifo metrics.fifo`, then `curl --unix-socket /tmp/firecracker.socket -X PUT http://localhost/metrics -d '{"metrics_path": "metrics.fifo"}'` or CLI `--metrics-path metrics.fifo`; the PUT body also accepts "emit_id": true (tags lines with the --id) and "properties": {...} custom key/values.
  3. Metrics flush automatically every 60 seconds; flush on demand with `curl --unix-socket /tmp/firecracker.socket -X PUT http://localhost/actions -d '{"action_type": "FlushMetrics"}'`.
  4. Read fifos in a loop (`read line <$logs`); plain files can just be cat'ed.
  5. Vsock (pre-boot): `curl --unix-socket /tmp/firecracker.socket -X PUT http://localhost/vsock -d '{"guest_cid": 3, "uds_path": "./v.sock"}'`.
  6. Host-initiated connections: connect to the uds_path AF_UNIX socket and send "CONNECT <port_num>\n"; if a guest listener exists on that AF_VSOCK port, Firecracker replies "OK <assigned_hostside_port>\n" and forwards; otherwise it terminates the host connection.
  7. Guest-initiated connections: the guest connects to HOST_CID (2) and a port; Firecracker forwards to an AF_UNIX socket that must ALREADY be listening at `<uds_path>_<port>` (e.g. ./v.sock_52); if nothing listens, the guest gets VIRTIO_VSOCK_OP_RST.
  8. Verify support: host kernel CONFIG_VHOST_VSOCK=m, guest kernel CONFIG_VIRTIO_VSOCKETS=y, and `ls /dev/vsock` succeeds in the guest.
  9. Official docs: https://github.com/firecracker-microvm/firecracker/blob/main/docs/logger.md, https://github.com/firecracker-microvm/firecracker/blob/main/docs/metrics.md, https://github.com/firecracker-microvm/firecracker/blob/main/docs/api_requests/actions.md, https://github.com/firecracker-microvm/firecracker/blob/main/docs/vsock.md

Known gotchas

Related routes

Set up a Firecracker vsock device and proxy host<->guest connections over a Unix socket
firecracker-microvm.github.io · 4 steps · unrated
Set up host-to-guest and guest-to-host communication in a Firecracker microVM over virtio-vsock
firecracker-microvm.github.io · 5 steps · unrated
Configure Firecracker logging to a file or named pipe with the single Logger
firecracker-microvm.github.io · 4 steps · unrated

Give your agent this knowledge — and 18,200+ more routes

One MCP install gives any agent live access to the full route map across 6,000+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans