Re: Add jsonlog log_destination for JSON server logs

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: "Bossart, Nathan" <bossartn(at)amazon(dot)com>
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" <david(at)fetter(dot)org>
Subject: Re: Add jsonlog log_destination for JSON server logs
Date: 2022-01-17 02:12:36
Message-ID: YeTQlLVpi3NR2axC@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 17, 2022 at 10:48:06AM +0900, Michael Paquier wrote:
> Okay, this last piece has been applied this morning, after more review
> and a couple of adjustments, mainly cosmetic (pg_current_logfile
> missed a refresh, incorrect copyright in jsonlog.c, etc.). Let's see
> what the buildfarm thinks.

By the way, while on it, using directly COPY to load the logs from a
generated .json file can be trickier than it looks, as backslashes
require an extra escap when loading the data. One idea, while not the
best performance-wise, is to rely on COPY FROM PROGRAM with commands
like that:
CREATE TABLE logs (data jsonb);
COPY logs FROM PROGRAM 'cat logs.json | sed ''s/\\/\\\\/g''';
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2022-01-17 02:17:24 Re: Null commitTS bug
Previous Message Michael Paquier 2022-01-17 01:48:06 Re: Add jsonlog log_destination for JSON server logs