Embedded Linux

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:

>_ Build Host Terminal
git clone https://github.com/spotflow-io/spotflowd.git

Pin 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:

>_ Yocto Build Terminal
bitbake-layers add-layer /path/to/spotflowd/yocto/meta-spotflow

Add the package to local.conf or your image recipe:

local.conf
IMAGE_INSTALL:append = " spotflowd"

Optionally enable kernel crash collection:

local.conf
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:

>_ Yocto Build Terminal
bitbake your-image

The 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:

/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:

>_ Device Terminal (systemd)
systemctl restart spotflowd
spotflowd status

For SysVinit:

>_ Device Terminal (SysVinit)
/etc/init.d/spotflowd restart
spotflowd status

Collection starts without waiting for network connectivity. The status command works offline.

Init System Defaults

Image configurationLog sourceService account
systemdjournaldspotflow, with journal access
SysVinit/var/log/messagesroot, for distribution-independent file access
crashdump enabledSelected log source plus pstoreroot

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:

local.conf
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.

Learn more

On this page