4 ms·
> what I need is for a terminal command that can recognize the meta fields from a log record and put them on a line separated from the main message Isn't this
by ryanianian 5y ago
> what I need is for a terminal command that can recognize the meta fields from a log record and put them on a line separated from the main message
Isn't this the exact use-case of structured logging?
Log events have
{timestamp, log level, log category, string message, ...arbitrary key/value pairs}
Usually serializing each message as a single json line in a file.
Since it's all on one line you can still use grep, but then since it's machine-readable you can pipe the grep to anything that can parse json. Vanilla python3 works and tends to be a part of most ops toolkits. Such tooling can split out the fields onto other lines etc or in a more reader-friendly format.
- gostsamo 5y agoYes, this has been my idea in many cases, but it is not always that I have a say over the logging format.