Logb

An open binary format for measurement, bus-trace and simulation data.


Self-describing, append-only, and readable from any cut face of the file. A recording carries its own bit-level signal definitions, so no sidecar database is needed to name and scale a channel.

 

✓ Specification published under MIT — nothing to buy, nobody to ask
✓ A conforming reader is about a thousand lines plus a decompressor



// A file is a sequence of self-contained segments.
// Each one restates every schema its data needs.

file    := file-header segment* [index-frame] [end-frame]
segment := sync-frame schema-frame+ run-frame*
           (meta | attach | data)*

// Cut the file anywhere and a reader resynchronises
// at the next sync frame, with full schema.

The gap this fills

The automotive industry has no open standard for test data. The one in common use is MDF, ASAM's Measurement Data Format, and it is considerably better than nothing — but its specification sits behind a paywall. That makes the price of writing a conforming reader a licence, and the price of checking someone else's reader another one. A format whose definition you cannot read is not a standard you can build on; it is a vendor relationship. The main alternative in CAN logging, Vector's BLF, is proprietary outright.

The problem is half solved, twice, by two families of format that do not overlap — and a bus or bench recording needs both halves.

Containers solve the file and punt on the payload

MCAP, Avro and friends get chunking, appending and compression right, but their messages are opaque bytes decoded "according to the schema of the channel". Record a CAN bus into one and you have stored the frame; naming EngineSpeed still needs the DBC sidecar.

Measurement formats solve the payload and are closed

MDF4 has a real bit-level signal model and is paywalled. TDMS is openly documented and streaming — then its metadata turns out to be incremental, so a cut file loses everything stated earlier.

Six rules the format is accountable to

The design is a varve — one season's sediment couplet in a lake bed, laid down in sequence, never rewritten, each layer self-dating, readable from any cut face of the core, including a core that snapped. If a proposed feature breaks one of these rules, the feature loses.

  1. Nothing points forward. A frame may reference earlier bytes, never later ones. The writer never seeks back to patch a field it already emitted, so it needs only a byte sink.
  2. Append-only, crash-safe. A file truncated at an arbitrary byte — power loss mid-write — is a valid file containing every record up to the last intact frame. No repair tool, no recovery mode.
  3. Cut anywhere, decode. A reader handed the middle of a file, with no access to the start, resynchronises and decodes records with full schema. Schema is repeated per segment, not stated once.
  4. No dependencies. A conforming reader is implementable in ~1000 lines with only a decompressor. No XML, no external schema registry, no library that must still exist in 2050.
  5. Raw is preserved. Stored values are the bits the sensor or bus produced; physical values are derived by a declared conversion, so a read-modify-write round trip is byte-identical.
  6. Fixed cost per record. Adding a channel does not change the cost of decoding an unrelated channel.

What the format provides

Self-describing records

A schema declares each field's bit offset, width, type, byte order and a conversion from raw to physical. The bit layout lives in the file, not in a sidecar the reader must go find a parser for.

A general domain axis

A transient sweeps time, an AC analysis sweeps frequency, a sweep can be angle or distance. The axis is implicit (zero bytes per record), explicit, or log-spaced — which is what a decade sweep actually is.

Per-field byte order

A single CAN frame routinely mixes Intel and Motorola signals, so byte order is per field, not per file — and bit numbering follows the byte order, which makes the Motorola sawtooth disappear. Read why →

Streamable by construction

No count is stated up front, so a file can be written before the run has finished. A simulator emits frames as it solves, and a long transient analysis becomes watchable while it runs.

Bounded blast radius

An unknown frame type costs nothing, an unknown codec or filter costs that frame, an unknown axis mode costs that stream. A v0.1 reader decodes a v0.9 file's v0.1 streams and reports the rest as unsupported — never garbage shaped like data.

Conformance vectors

The specification carries test vectors, and the bit-numbering rules are defined by them rather than by prose. A byte-reproducible example file is part of the repository.

Not an automotive format

Logb was born in an automotive context, but the domain axis is general rather than time-specific. Bus traces, bench measurements and simulator output are the same kind of file here.

Bus recording

CAN, CAN FD, LIN

Signal definitions travel with the recording. A DBC importer reduces to a one-line offset transform, and a tool with no DBC can still name and scale every signal.

Bench measurement

Loggers and instruments

An embedded logger needs only a byte sink and never seeks. Pull the power mid-write and the file is still valid up to the last intact frame.

Simulation

SPICE and friends

§11 of the specification is a complete mapping from ngspice and LTspice .raw onto Logb — without the up-front point count that stops a .raw file from being written as it is produced.

Implementations

Logb is a format, and the specification is the artifact that matters. One implementation happens to exist today — a reference library in Go — but it is one possible implementation, not the definition. Where the two disagree, the specification wins and the implementation is the bug.

There is nothing to license and no consortium to join. If you write a reader or writer in another language, it belongs on this page.

Go reference implementation Conformance vectors Format specification
STATUS

Draft v0.1

The format is not frozen. What is implemented, what is not, and the design decisions behind it are written down — as are the open questions where the design is still genuinely undecided.