The Log tracer wrote text only: `<time> <LEVEL> <description> (<event id>)
key = value, ...`, with quotes inside strings left unescaped, so neither a
log collector (Loki, Vector, Kubernetes) nor the console's Logs page could
read the fields exactly. Requested in community t/308.
A Log tracer now has a `format` (monitoring spec MON-43): `text`, the
default and unchanged, or `json`, one object per line:
{"timestamp", "level", "event", "description", "data"}, where `timestamp`
is RFC 3339, `level` lowercase, and `data` holds the event's keys and its
span's as typed values, nested events as objects and lists as arrays (the
same encoding as webhooks). `ansi` and `multiline` apply to text only.
Changing the format restarts the tracer like any other setting, after the
old one has written what it queued.
x:Log/get and x:Log/query, with all of #455's filters, read both formats,
and a file holding both (a tracer switched over) reads in order. A JSON
entry's `details` is its `data` as a JSON object ("" when it has none);
inbuxa-admin #246 shows those fields as written.
The format is stored at x:Tracer and x:Bootstrap version 3 (the bootstrap
holds a tracer too, and more fields follow it there, so both move
together); tracers saved before read back as text. A server from before
this reads a newer tracer's fields up to its own and ignores the format,
writing text.
The served schema has the LogFormat enum and the field, after Rotate
frequency on the Log file form, so inbuxa Admin offers it.
Test: unit tests for the line (one typed object, escapes kept), for
reading JSON and mixed files through every filter, for a tracer's output
reading back exactly, and for the stored format (a tracer and a bootstrap
saved at the old versions read back as text; saved now, as JSON). The
tracer reload system test switches a running tracer to JSON and checks
the next line is JSON while the earlier ones stay text.
Fixes#456.