Re: Add jsonlog log_destination for JSON server logs
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Andrew Dunstan <andrew@dunslane.net>, Andres Freund <andres@anarazel.de>, Sehrope Sarkuni <sehrope@jackdb.com>, Pg Hackers <pgsql-hackers@postgresql.org>, david@fetter.org
Date: 2022-02-11T01:24:59Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Introduce log_destination=jsonlog
- dc686681e079 15.0 landed
-
Refactor set of routines specific to elog.c
- ac7c80758a7a 15.0 landed
-
Fix compilation warning in syslogger.c
- 05c4248ad1bf 15.0 landed
-
Refactor per-destination file rotation in logging collector
- 5c6e33f07153 15.0 landed
-
Refactor output file handling when forking syslogger under EXEC_BACKEND
- 5b0b699f748e 15.0 landed
-
Add regression tests for csvlog with the logging collector
- 72b76f76161c 15.0 landed
-
Refactor the syslogger pipe protocol to use a bitmask for its options
- 2d77d835403a 15.0 landed
On Thu, Feb 10, 2022 at 07:45:17PM -0300, Alvaro Herrera wrote: > 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. Yes, I have been pinged about that, which is why there are still cases for my out-of-core extension jsonlog that uses the elog hook. > I think this would be a relatively easy patch to do. Opinions? The postmaster goes through a couple of loops with the fd to open for the default format, that the syslogger inherits from the postmaster, and I am pretty sure that there are a couple of code paths around the postmaster startup that can be tricky to reason about. Making the new parameter PGC_POSTMASTER makes things easier to handle, still the postmaster generates a couple of LOG entries and redirects them to stderr before loading any GUC values, which would mean that we cannot make sure that all the logs are valid JSON objects. If we want to be 100% waterproof here, we may want to track down the format to use by default with a mean different than a GUC for the postmaster startup? A file holding this information in the root of the data folder would be one way. -- Michael