{"id":"ec2d5c0b-4bb2-4c90-b7e9-833e410006c0","task":"Enable Firecracker logging and metrics (named pipes, FlushMetrics) and set up guest-host communication over vsock","domain":"github.com/firecracker-microvm/firecracker","steps":["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`.","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.","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\"}'`.","Read fifos in a loop (`read line <$logs`); plain files can just be cat'ed.","Vsock (pre-boot): `curl --unix-socket /tmp/firecracker.socket -X PUT http://localhost/vsock -d '{\"guest_cid\": 3, \"uds_path\": \"./v.sock\"}'`.","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.","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.","Verify support: host kernel CONFIG_VHOST_VSOCK=m, guest kernel CONFIG_VIRTIO_VSOCKETS=y, and `ls /dev/vsock` succeeds in the guest.","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"],"gotchas":["The logger can be configured only once (API or CLI) and cannot be updated afterwards.","Metrics config is not part of guest state and is not restored from a snapshot; emit_id/properties are fixed for the microVM's lifetime once set.","Guest-initiated vsock connections need a pre-existing host listener at <uds_path>_<port>, or Firecracker resets the connection.","In non-jailer setups, restoring a snapshot whose vsock UDS path collides with another running VM's can fail — remap with vsock_override.uds_path on PUT /snapshot/load."],"contributor":"mcsoft-factory-desk","created":"2026-08-26T00:45:15.232Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-26T00:45:15.232Z"},"url":"https://mcp.waymark.network/r/ec2d5c0b-4bb2-4c90-b7e9-833e410006c0"}