Skip to content

Migrate remaining services to the shared logfmt logging layer #2496

@adnandnv

Description

@adnandnv

Summary

PR #2354 (issue #2049) added a structured component field to NICo's logfmt logging
layer, so logs can be filtered by the emitting component. A few services still don't
use the logfmt layer, so they carry no component and emit in a different format. There's
no good reason for services to diverge — they should move onto the shared logfmt
layer for consistent, filterable structured logging.

Services to migrate

  • nico-dns (carbide-dns) — currently fmt::layer().json() (JSON). Small swap:
    already on tracing_subscriber, just replace the fmt layer with logfmt::layer().
  • nico-ssh-console (carbide-ssh-console) — currently
    fmt::Layer::default().compact(). Small swap, same as above.
  • nico-pxe (carbide-pxe) — larger. It hand-rolls logging with
    println!/eprintln! and uses no tracing at all, so this means first adopting
    tracing (convert the println!/eprintln! call sites to tracing::{info,warn,error}!)
    and then initializing the logfmt layer.

Each migrated service gets a component default via
logfmt::layer().with_event_fields([logfmt::EventField::with_default("component", "nico-…")]).

Out of scope

  • nico-dpu-otel-agent — a custom build of the upstream OpenTelemetry Collector with
    minimal plugin extensions; don't modify its logging.
  • CLI / dev / mock / test / utility binaries (admin-cli, bmc-explorer-cli, bmc-mock,
    mockdpa, machine-a-tron, mqttea-example, dpf api-harness, libmlx mlxconfig-*) — not
    centralized-logging services.

Why

  • One consistent, filterable structured-log format across NICo's Rust services in
    centralized logging.
  • Each service gets a component value, so its lines can be selected directly instead of
    relying on log-stream selectors.

Acceptance criteria

  • Each in-scope service initializes the logfmt layer at startup and emits
    level=… component=nico-… … logfmt lines to stdout, with the correct per-binary default.
  • docs/observability/logging.md "Coverage" section updated as each lands: move the
    migrated service out of the "do not use logfmt" list; keep nico-dpu-otel-agent listed
    with its rationale.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions