Open bushjames opened 3 years ago
Setting the space
parameter of the logger config to 0
causes the logger to print one line per log event.
Note that this is exposed to the service config; setting LOG_INDENT=0
in the process environment will print a single line per log event.
One problem that may be encountered using jq for log filtering is if not every line printed is a json object. This can be worked around when printing ndjson or jsonl with the following (copied verbatim from my notes on the subject):
Given a log that contains pretty-printed json with some errors, we can add some delimiters and use
--seq
to instructjq
to ignore failed parses:kubectl log -f deploy/some-application | sed 's/^{/'`echo "\036"`'{/' | jq --seq '.'
See
--seq
in thejq
manual for more.
It would probably be wise to migrate mojaloop connector to use pino
instead of the in-house logger. This reduces the maintenance burden. See the PR where this was done in finance portal backend:
https://github.com/mojaloop/finance-portal-backend-service/pull/73
It might pay to check whether there are any additional changes to portal backend since then, for example to improve the formatting of stack traces or similar. This would also enable the use of pino-pretty
, which can be used to pretty-print pino logs from a locally running service, or when run in k8s.
Find a way to reduce log volume (possibly not log health checks?) and dont pretty print JSON; e.g. use one line per JSON object.