Skip to content

id(structured-logging): an unrecognized ID_LOG_FORMAT silently resolves to text — no fallback warning, unlike ID_LOG_TZ #5434

Closed

Description

@dezren39

Problem

An unrecognized ID_LOG_FORMAT value silently resolves to text logging, with no warning anywhere — unlike the neighbouring ID_LOG_TZ knob, whose unrecognized values fall back to UTC and warn, by design.

Evidence (verified this run, main 0ab687345)

  • pkgs/id/src/structured_logging.rs — LogFormat::parse: "anything unrecognized is Text". Probe on the laptop (~/git/fleet/probe-logformat, the function extracted verbatim) printed:

    ID_LOG_FORMAT=Some("josn") -> Text
    ID_LOG_FORMAT=Some("jsonl") -> Text
    ID_LOG_FORMAT=Some("structured") -> Text
    ID_LOG_FORMAT=Some("yaml") -> Text
    

    (controls: None/""/"text" → Text, "json"/" JSON " → Json.)

  • LogConfig (same file) carries a tz_fell_back: bool for the timezone knob but no equivalent flag for the format — the information that the value was unrecognized is discarded inside parse.

  • pkgs/id/src/main.rs init_logging (line ~99) warns on stderr for config.tz_fell_back ("warning: ID_LOG_TZ value not recognized; log timestamps use UTC") and for a log file that cannot be opened, but has nothing to warn about for format, because the flag does not exist.

  • The module header documents the tz behaviour as the designed pattern: "an unrecognized value falls back to UTC and the caller warns about the fallback."

Why it matters

An operator who sets ID_LOG_FORMAT=josn (or jsonl, or any near-miss) while wiring logs into a JSON ingester gets plain-text logs and no signal at any point — the exact silent-misconfiguration failure the tz fallback warning exists to prevent. The two knobs sit side by side in the same config struct and the same doc block; only one of them warns.

Acceptance criteria

  • LogConfig records whether a set, non-empty ID_LOG_FORMAT value was unrecognized (unset/empty/text/json, case-insensitive after trim, never set the flag — mirroring how unset/empty tz never sets tz_fell_back).
  • init_logging in pkgs/id/src/main.rs prints a stderr warning naming ID_LOG_FORMAT when the flag is set, in the same style as the existing ID_LOG_TZ warning, before tracing starts.
  • The resolved format itself is unchanged: unrecognized values still resolve to Text (no behaviour break for anyone relying on the lenient parse).
  • Tests in structured_logging.rs pin the table: recognized values and unset/empty leave the flag clear; josn/yaml set it while still resolving to Text.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    source/creatorFiled by the new-issue-creator job
    on Nov 4, 2026
  2. developing-today commented on Nov 4, 2026

    @developing-today
    Contributor
  3. added
    priority/lowNice to have; do when convenient
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    work/self-assignedAn agent grabbed this item directly, outside the queue
    on Nov 4, 2026
  4. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · state: filed

    • Agent: new-issue-creator job (new-issue-creator-code-a)
    • Session / ID: new-issue-creator-code-a run, 2026-11-04 06:05 CST
    • Found via: filed this run
    • Task: Filed after verifying on the laptop (probe ~/git/fleet/probe-logformat, LogFormat::parse extracted verbatim from main 0ab687345): every unrecognized non-empty ID_LOG_FORMAT resolves to Text, LogConfig carries tz_fell_back but no format equivalent, and init_logging warns only for the tz fallback. Guarded self-solve this run (protocol §4): the fix is trivial and clearly scoped — a format_fell_back flag on LogConfig, the mirroring stderr warning in init_logging, and pinning tests. No queue packet is enqueued for this issue; it is held via work/self-assigned.
    • Expectation: effort xs; done = PR merged with the flag + warning + tests, targeted structured_logging tests green on the laptop.
    • Links: body evidence in the issue; branch creator-a/5434-logformat-fallback-warning (PR to follow)
  5. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · state: done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/idPackage/app: id (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions