Products › lamco-dbus-tools › Docs
dbuskeep: The service that keeps a rolling D-Bus record
dbuskeep, the service that keeps a rolling D-Bus record: Where it answers, who may ask, what a reader gets, and how it applies match rules as each bus does.
Describes version 0.4.1. The source of truth is src/keep/ and src/listen/via_keep.rs.
dbuskeep run is one monitor of a whole bus for every program that reads it, with the last --window
seconds of what it read kept. It's never required: Every program works without it, and uses it when it
finds it.
Where it answers
A socket named by the bus's id, so whatever address a program reaches the bus by, it finds the service of that bus:
| Service | Socket | Directory |
|---|---|---|
| A user's | $XDG_RUNTIME_DIR/lamco-dbus-tools/keep/<bus id>.sock, mode 0600 |
0700 |
| The system's, run as root | /run/lamco-dbus-tools/keep/<bus id>.sock, mode 0666 |
0755 |
It never answers over the bus it watches. A second service for the same bus refuses to start while the first answers. On SIGINT or SIGTERM it stops and removes its socket.
Who may ask
Each reader's credentials come from the socket (SO_PEERCRED), and its groups from /proc/<pid>/status, which must still be that user's process: A reader that connected and exited, its pid since reused, is refused rather than judged by the new process's groups.
| Service | Answers |
|---|---|
| A user's | That user, and root |
| The system's | Root, and members of lamco-dbus-monitor, the group the helper already lets record the system bus |
Any other reader gets one line saying why, and nothing else.
What a reader asks, and gets
One line of JSON, then the service's answer line:
| Request | Answer |
|---|---|
{"ask": "status"} |
{"ok": true, "status": {...}}: Its process, version, bus and id, window, the messages and bytes it holds, the oldest's arrival, the messages read since it began, how many it let go, its readers |
{"ask": "follow", "from_ns": N, "budget_bytes": B, "rules": [...]} |
{"ok": true}, then the helper's frames (the helper): A hello naming the service, an owners frame, the kept messages that arrived at N or later, then the live ones until the reader closes its side. With rules, only the messages one of them takes. A rule the service can't read is refused in the answer |
from_ns is on the machine's CLOCK_MONOTONIC; left out, the messages from now. The hello's service
gives the program, its version, the socket, the window, the most it holds and when its monitor began. The
owners frame (O) gives each well-known name's owner as of the first message sent, from the service's
snapshot when it began and the bus's owner changes since, and how many messages follow from the history.
rules are match rules, applied as the bus the service watches applies a monitor's rules, dbus-daemon's way
or dbus-broker's where they differ (match rules): Each message is tested with who owned
each name when it passed, and only what a rule takes is queued, so a reader's budget and pace are those of
what it takes. Left out, the reader gets everything.
A reader that falls behind
The service queues messages for each reader on its own thread and never makes its monitor wait. When more
than the reader's budget_bytes waits to be written to it (default 16 MiB, and never more than 256 MiB, whatever the reader asks), the service stops queueing
for it, sends what's queued, then an end with ended detached and why. A recorder asks with its own
--budget and stops reading its socket while more than that waits for its writer, so a stopped or slow
recorder is let go at the service as its own monitor would let go, and the bus and the other readers
never wait.
Who uses it
| Program | When |
|---|---|
dbussee record, watch, pending, with --all, --service or --match |
When a service keeps the bus and --no-keep and --helper aren't given; with rules, the service applies them. The capture's monitor record names the service in service, and who filtered in filtered_by |
dbussee record --ring ... --now |
With a service, the ring starts from the last --ring seconds it kept and fires once they're all taken: The recording returns at once with what happened before it began. Without one, it fires on what came since it began |
dbuskeep status |
Asks the service of the bus what it holds |
A recording with rules reads through the service as one of everything does, and costs the bus nothing more
than the service's own monitor: Measured on 2026-12-01 (docs/measurements/stage-14/), a rule that takes every message
costs the bus 3 to 4% with a monitor of its own and nothing through the service, which pays about 3.5 µs a
message instead.
Units
packaging/systemd/user/dbuskeep.service runs dbuskeep run for a user's session bus.
packaging/systemd/system/dbuskeep.service runs dbuskeep --bus system run as root, with
/run/lamco-dbus-tools as its runtime directory and the sandboxing systemd offers: systemd-analyze
security rated it 3.1, OK, on Fedora 45. On dbus-daemon before 1.16.4, which has the flaw of BUS-003,
the system's service refuses to start until --accept-known-flaw is added, for example with systemctl
edit dbuskeep and a drop-in of [Service], ExecStart= and ExecStart=/usr/bin/dbuskeep --bus system run
--accept-known-flaw. Run so on Debian 13's dbus-daemon 1.16.2, a member of the group recorded the system bus
through it as on Fedora's dbus-broker.