Summary
A structured-log call passes the key ID as a bare positional argument, so it is
rendered into the message as a formatting artefact instead of a field.
app/upbridge/upbridge.go:98:
ub.log.Info("Key not found in cache, contacting nodeman", keyID)
Observed output:
{"level":"INFO","msg":"Key not found in cache, contacting nodeman%!(EXTRA string=edge-receiver-01.edge.test)"}
The node name ends up glued to the message text, so it cannot be filtered or
indexed as a field, and the %!(EXTRA ...) marker leaks into logs.
Reproduction
mqtt-bridge abe75e1. Run the bridge in up mode with Debug = true and
publish a signed message from a node whose key is not yet cached; the line
appears on the first message from each node.
Expected behaviour
The key ID should be a named attribute, matching the other calls in the package.
Suggested fix
-ub.log.Info("Key not found in cache, contacting nodeman", keyID)
+ub.log.Info("Key not found in cache, contacting nodeman", "key_id", keyID)
Worth a quick grep for other odd-argument logging calls at the same time; go vet does not catch this for slog, but sloglint or staticcheck's
SA1029-adjacent checks can.
Summary
A structured-log call passes the key ID as a bare positional argument, so it is
rendered into the message as a formatting artefact instead of a field.
app/upbridge/upbridge.go:98:Observed output:
The node name ends up glued to the message text, so it cannot be filtered or
indexed as a field, and the
%!(EXTRA ...)marker leaks into logs.Reproduction
mqtt-bridge
abe75e1. Run the bridge inupmode withDebug = trueandpublish a signed message from a node whose key is not yet cached; the line
appears on the first message from each node.
Expected behaviour
The key ID should be a named attribute, matching the other calls in the package.
Suggested fix
Worth a quick grep for other odd-argument logging calls at the same time;
go vetdoes not catch this forslog, butsloglintorstaticcheck'sSA1029-adjacent checks can.