You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Log galactic-cni and fabric-config-agent as JSON at info #1165
Deliverable:galactic-cni and fabric-config-agent log as JSON at info level and honor LOG_LEVEL and LOG_FORMAT, like the binaries #1155 moved to internal/logging.
Both are long-running and log through slog's default handler, which nothing configures. Their lines are Go's default text format, and --log-level/--log-format don't exist for them.
galactic-cni's installer and its credential-refresh daemon log through slog throughout internal/installer, and the command exits through log.Fatalf in plain text.
fabric-config-agent, as the frr-init init container and the config-agent sidecar, logs through slog's default as well.
The CNI plugins (galactic-veth, -tap, -ipam, -bgp, -route) already write JSON to their log file and are out of scope. So is galactic-usid, a one-shot codec command in the debug image.
This is an interim step that doesn't wait for the library. #1147 moves these binaries onto the instrumentation library and supersedes this issue if it lands first.
Work items:
Call internal/logging from each binary's root command, as the controller-runtime binaries do, and report a startup error through the installed handler.
Extend TestBinariesUseThisPackage, or add a sibling test, so it fails when a long-running binary under cmd/ logs without installing the shared handler.
Document both binaries in the logging reference.
Dependencies: none.
Acceptance: In the lab, every line from both binaries' pods is JSON at info level by default, and LOG_LEVEL=debug adds debug lines.
Both binaries built from that commit reject the shared flags and write plain text:
$ galactic-cni init --log-level debug2026/10/27 17:05:24 error: unknown flag: --log-level
$ galactic-cni init2026/10/27 17:05:24 error: node name is required (use --node-name flag or GALACTIC_CNI_NODE_NAME env var)
$ fabric-config-agent init --log-format jsonError: unknown flag: --log-format
Two findings beyond the issue text:
galactic-cni's root command doesn't set SilenceUsage, so cobra prints the full usage text on every runtime error from init or run, not only on bad flags.
cmd/galactic-cni/main.go and cmd/fabric-config-agent/main.go bind logging.Options on the root command's persistent flags and call Setup from PersistentPreRunE, as galactic-router does. Both set SilenceErrors and SilenceUsage, and main logs the returned error with slog.Error before exiting 1. That replaces galactic-cni's log.Fatalf.
A sibling of TestBinariesUseThisPackage requires every package under cmd/ to import internal/logging, except the five CNI plugins and galactic-usid, which are listed with the reason. It fails today for both binaries.
docs/observability/logging.md lists both binaries and drops the sentence saying they configure logging separately.
Risk: both binaries gain --log-level and --log-format and read LOG_LEVEL and LOG_FORMAT. Neither manifest sets those, so pods switch to JSON at info. Debug lines the binaries already emit stay hidden unless LOG_LEVEL=debug is set, which matches Go's default handler today.
Activity
privateip commentedon Oct 27, 2026
Confirmed on
mainat ea783e8.Both binaries built from that commit reject the shared flags and write plain text:
Two findings beyond the issue text:
galactic-cni's root command doesn't setSilenceUsage, so cobra prints the full usage text on every runtime error frominitorrun, not only on bad flags.Error: ...as text andmainexits. The fix here logs it through slog for these two binaries.privateip commentedon Oct 27, 2026
Plan, taken from the issue's work items:
cmd/galactic-cni/main.goandcmd/fabric-config-agent/main.gobindlogging.Optionson the root command's persistent flags and callSetupfromPersistentPreRunE, asgalactic-routerdoes. Both setSilenceErrorsandSilenceUsage, andmainlogs the returned error withslog.Errorbefore exiting 1. That replacesgalactic-cni'slog.Fatalf.TestBinariesUseThisPackagerequires every package undercmd/to importinternal/logging, except the five CNI plugins andgalactic-usid, which are listed with the reason. It fails today for both binaries.docs/observability/logging.mdlists both binaries and drops the sentence saying they configure logging separately.Risk: both binaries gain
--log-leveland--log-formatand readLOG_LEVELandLOG_FORMAT. Neither manifest sets those, so pods switch to JSON at info. Debug lines the binaries already emit stay hidden unlessLOG_LEVEL=debugis set, which matches Go's default handler today.fix(logging): Log galactic-cni and fabric-config-agent as JSON