Feature Request: Keep row data and query text out of log messages
Feature Description
Vitess v24 logs JSON by default. A lot of call sites still build the message with fmt.Sprintf (or pass err.Error()), so variable data ends up inside msg. That includes row values, last primary keys, binlog event contents, and query text.
This matters for anyone running Vitess as a managed database and publicizing those logs. Shipping a row or a query in a log line is a compliance problem, and redacting the rendered string after the fact is brittle. Structured logging already has a place for that data: slog attributes. A log pipeline can keep msg and drop the attributes it does not want to retain.
Proposed change:
- Log messages become fixed sentences.
- Anything that varies (row values, last primary keys, event contents, query text) moves to an attribute. Names that are safe to keep, like table or workflow, get their own attributes.
- A lint in the affected packages rejects a non-constant message, including err.Error() and a %v of a struct, so this does not regress.
Use Case(s)
Operators running Vitess want to show tablet, vtgate, and vtorc logs to the customers who own each keyspace, the same way they already show MySQL or Postgres logs. Today those logs can't be exposed as-is, because some messages include row values, last primary keys, binlog event contents, and query text (for example the extractRowAndFilter error in vstreamer, or the last-PK line when a table copy starts). Under compliance regimes like SOC 2, HIPAA, or GDPR, a log line containing customer data has to be treated as customer data, which rules out forwarding those lines without redaction.
Source: vitessio/vitess