Re: Add jsonlog log_destination for JSON server logs

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Sehrope Sarkuni <sehrope(at)jackdb(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, david(at)fetter(dot)org
Subject: Re: Add jsonlog log_destination for JSON server logs
Date: 2021-09-14 06:06:41
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Sep 13, 2021 at 11:56:52PM -0400, Sehrope Sarkuni wrote:
> Good catch. Staring at that piece again, that's tricky as it tries to
> aggressively free the buffer before calling write_cvslog(...). Which can't
> just be duplicated for additional destinations.
> I think we need to pull up the negative case (i.e. syslogger not available)
> before the other destinations and if it matches, free and exit early.
> Otherwise, free the buffer and call whatever destination routines are
> enabled.

Yes, I got a similar impression.

> I started on a bit of this as well. There's so much overlap already between
> the syslog_ and csvlog code that I'm going to put that together first. Then
> the json addition should just fall into a couple of call sites.
> I'm thinking of adding an internal struct to house the FILE* and file
> names. Then all the opening, closing, and log rotation code can pass
> pointers to those and centralize the pfree() and NULL checks.

Agreed on both points (using a structure and doing the refactoring as
a first patch).

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey V. Lepikhov 2021-09-14 06:37:39 Re: Asymmetric partition-wise JOIN
Previous Message Amul Sul 2021-09-14 06:05:01 Deduplicate code updating ControleFile's DBState.