Re: Add jsonlog log_destination for JSON server logs

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Add jsonlog log_destination for JSON server logs
Дата
Msg-id YUA78XrG3l7eVY4h@paquier.xyz
обсуждение исходный текст
Ответ на Re: Add jsonlog log_destination for JSON server logs  (Sehrope Sarkuni <sehrope@jackdb.com>)
Ответы Re: Add jsonlog log_destination for JSON server logs  (Sehrope Sarkuni <sehrope@jackdb.com>)
Список 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).
--
Michael

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amul Sul
Дата:
Сообщение: Deduplicate code updating ControleFile's DBState.
Следующее
От: "Andrey V. Lepikhov"
Дата:
Сообщение: Re: Asymmetric partition-wise JOIN