Re: Proposal: Adding json logging

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Christophe Pettus <xof(at)thebuild(dot)com>, David Arnold <dar(at)xoe(dot)solutions>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Proposal: Adding json logging
Date: 2018-04-19 00:26:04
Message-ID: 20180419002604.GB957@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Apr 18, 2018 at 02:59:26PM -0400, Robert Haas wrote:
> ====
> Note that logging_collector should be enabled in postgresql.conf to
> ensure consistent log outputs. As JSON strings are longer than normal
> logs generated by PostgreSQL, this module increases the odds of malformed
> log entries.
> ====
>
> I'm not sure I understand the issue, but I don't like malformed log entries.

If logging_collector is disabled, then all the log entries would just go
to stderr (that's mentioned in the docs). While that may be fine for
low volumes of logs, for many concurrent processes generating logs then
a process can overwrite another process log entry. The logs generated by
the JSON format are longer in length, increased mainly by the repetitive
use of the key names in the blob, which increase in turn the volume
generated.

So in this case this can cause JSON blobs to look broken. I had a
report on github not long ago about that:
https://github.com/michaelpq/pg_plugins/issues/17
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-04-19 00:33:27 Re: Proposal: Adding json logging
Previous Message Michael Paquier 2018-04-19 00:15:48 Re: Fix for documentation of Covering Indexes