Re: Add jsonlog log_destination for JSON server logs

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Andres Freund <andres(at)anarazel(dot)de>, Sehrope Sarkuni <sehrope(at)jackdb(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, david(at)fetter(dot)org
Subject: Re: Add jsonlog log_destination for JSON server logs
Date: 2022-02-10 22:45:17
Message-ID: 202202102245.6uvvvzulzkqy@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

So, thinking about this, there is one important piece that is missing
here, which is the ability to change the default format for what we
write to stderr. Right now, if you have stderr output, it is always in
the "plain multiline" format, with no option to change it. If you want
a JSON log, you have to read a file. But ISTM it would be pretty useful
if you could say "log_default_format=json" and get the log that we get
in stderr in the JSON format instead.

From what I hear in the container world, what they would *prefer* (but
they don't often get) is to receive the JSON-format logs directly in
stderr from the daemons they run; they capture stderr and they have the
logs just in the format they need, without having to open the log files,
parsing the lines to rewrite in a different format as is done currently.

I think this would be a relatively easy patch to do. Opinions?

--
Álvaro Herrera Valdivia, Chile — https://www.EnterpriseDB.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-02-10 23:10:48 Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints
Previous Message Tomas Vondra 2022-02-10 22:37:26 Re: Merging statistics from children instead of re-sampling everything