Structured Logging
All Open Sesame daemons use the tracing crate for structured, leveled logging. Log output is
configurable between JSON and human-readable formats, with journald integration on Linux.
Tracing Integration
Every daemon initializes a tracing-subscriber stack at startup. The two supported output
formats are:
- JSON (
--log-format json, default for daemon-profile): machine-parseable structured JSON, one object per line. Enabled viatracing_subscriber::fmt().json().init(). - Pretty (
--log-format pretty): human-readable colored output viatracing_subscriber::fmt().init().
The format is selected via the --log-format CLI flag or the PDS_LOG_FORMAT environment
variable. The implementation is in daemon-profile/src/sandbox.rs (init_logging).
RUST_LOG and Log Levels
All daemons read the RUST_LOG environment variable via
tracing_subscriber::EnvFilter::try_from_default_env(). If RUST_LOG is not set, the default
filter is info.
Standard tracing levels are used throughout:
| Level | Usage |
|---|---|
error | IPC failures, secret fetch denials, audit chain verification failures, sandbox application failures. |
warn | Non-fatal issues: systemd-run fallback, corrupt audit tail entry, HTTP git URL detected. |
info | Daemon lifecycle (starting, ready, shutting down), launch execution, watchdog ticks, config reloads, key rotation, audit chain verification on startup. |
debug | Child reaping status, context engine debounce suppression. |
journald Integration
The tracing-journald crate is a Linux dependency of daemon-launcher and other daemons. When
running under systemd, structured log fields are forwarded to the journal as journal fields,
enabling filtering with journalctl:
journalctl --user -u daemon-launcher.service
journalctl --user -u daemon-profile.service
Structured Fields
Tracing spans and events use structured key-value fields throughout the codebase. Notable patterns:
- Launch execution:
entry_id,program,arg_count,scope_name,tags,devshell,env_count,secret_count,via_scope,pidare attached to launch log lines indaemon-launcher/src/launch.rs. - Secret fetching:
secret_countand per-secretreasonfields on denial. - Watchdog:
watchdog_tick_counttracks event loop health indaemon-profile/src/main.rs. - IPC messages:
senderandmsg_ididentify message origin. - Audit:
path,sequence,entriestrack audit log state at startup. - Security posture: sandbox
statusis logged after Landlock and seccomp application. - Key rotation:
daemon_name,generation,clearancefields on rotation events. - Desktop entry resolution:
entry_id,resolved_idlogged with the resolution strategy used.
Daemon Startup Logging Sequence
Daemon-profile follows this startup sequence (other daemons follow a similar pattern):
"daemon-profile starting"– logged immediately after CLI parsing.harden_process()andapply_resource_limits()– the platform layer hardens the process (RLIMIT_NOFILE, RLIMIT_MEMLOCK, etc.).init_secure_memory()– probesmemfd_secret(2)availability and logs whether the kernel supports sealed anonymous memory for secret storage.- Sandbox application – logs the Landlock and seccomp result via
?statusstructured field. - IPC bus server bind – logs
pathand confirms Noise IK encryption. - Per-daemon keypair generation – logs
daemon,clearancefor each of the six known daemons. - Audit logger initialization – logs
pathandsequence(chain head position). - Audit chain verification – logs
entriescount if the chain is intact, or an error if verification fails. - Context engine initialization – logs
profile(the default ProfileId). platform_linux::systemd::notify_ready()– sendsREADY=1to systemd."daemon-profile ready"– logged after readiness notification.