Yocto Integration
Include spotflowd in Yocto and OpenEmbedded images using the meta-spotflow layer.
The meta-spotflow layer builds and installs spotflowd into your device image.
It supports Poky/OpenEmbedded Scarthgap (5.0) and Styhead (5.1) with systemd or SysVinit and depends only on OE-Core.
It can also be included in Yocto-based Avocado OS image builds.
Get the Source
Clone the daemon repository on your build host:
git clone https://github.com/spotflow-io/spotflowd.gitPin its revision in your image's source manifest for reproducible production builds.
Keep the full repository together: the layer builds the checkout it ships with, so copying only meta-spotflow is not supported.
Register the Layer
In your initialized Yocto build environment:
bitbake-layers add-layer /path/to/spotflowd/yocto/meta-spotflowAdd the package to local.conf or your image recipe:
IMAGE_INSTALL:append = " spotflowd"Optionally enable kernel crash collection:
PACKAGECONFIG:append:pn-spotflowd = " crashdump"This option configures root execution and pstore access, but your BSP must supply the kernel's pstore backend and any required reserved RAM.
Build and Boot the Image
Build your image as usual, replacing your-image with your image target:
bitbake your-imageThe recipe fetches checksummed Cargo dependencies during do_fetch and compiles offline with the distribution's Rust toolchain.
It installs the appropriate init files, CA certificates, and selected syslog provider where needed.
Provision Device Credentials
After booting the device, edit the existing [device] section of /etc/spotflow/spotflowd.toml:
[device]
id = "linux-device-001"
ingest_key = "<your-ingest-key>"Preserve the installed log and storage settings and the file's restrictive permissions. Provision a stable, unique device ID and a key from Ingest Keys. Prefer device-specific provisioning over baking a shared secret into a fleet-wide image.
The service is enabled automatically, but a systemd device without credentials remains stopped. SysVinit reports a configuration-check failure until provisioned. Restart after provisioning, running as root:
systemctl restart spotflowd
spotflowd statusFor SysVinit:
/etc/init.d/spotflowd restart
spotflowd statusCollection starts without waiting for network connectivity. The status command works offline.
Init System Defaults
| Image configuration | Log source | Service account |
|---|---|---|
| systemd | journald | spotflow, with journal access |
| SysVinit | /var/log/messages | root, for distribution-independent file access |
crashdump enabled | Selected log source plus pstore | root |
The selected logger must write the configured syslog file. BusyBox's IPC-only -C mode is not supported as a file source.
To select syslog instead of journald on a systemd image:
PACKAGECONFIG:pn-spotflowd = ""
SPOTFLOWD_SYSLOG_PATH:pn-spotflowd = "/var/log/messages"An empty PACKAGECONFIG also disables optional crash collection; append " crashdump" if required.
For account overrides and custom image-provided configuration, see the upstream Yocto reference.
Persistent Storage and Read-Only Images
The default state directory is /var/lib/spotflow, with separate subdirectories for log chunks, metric sequence numbers, and crash deduplication state.
Runtime sockets are created under /run when the service starts.
Read-only root filesystems need a writable mount or overlay for the state directory and a provisioning strategy for the configuration file. Volatile state storage works but loses its contents on reboot.
If you change [storage].state_dir, provision ownership for the service account and allow the new path in systemd's ReadWritePaths.
The log spool size limit does not bound the entire state directory.
Configuration is preserved across package upgrades.