Re: Proposal: More structured logging

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Ronan Dunklau <ronan(dot)dunklau(at)aiven(dot)io>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Proposal: More structured logging
Date: 2021-08-19 13:04:30
Message-ID: 202108191304.u7g5wwuepwpe@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021-Aug-13, Ronan Dunklau wrote:

> ereport(NOTICE,
> (errmsg("My log message")),
> (errtag("EMITTER", "MYEXTENSION")),
> (errtag("MSG-ID", "%d", error_message_id))
> );

Interesting idea. I agree this would be useful.

> Please find attached a very small POC patch to better demonstrate what I
> propose.

Seems like a good start. I think a further step towards a committable
patch would include a test module that uses the new tagging
functionality.

> On a related note, the only structured logger we have in-core is the CSV
> logger. Many users nowadays end up feeding the logs to journald either by
> capturing the stderr output with systemd, or by having syslog implemented by
> journald itself. Would there be any interest in having native journald support
> as a logging_destination ?

I don't know anything about journald, but I agree that we sorely need
some better way to emit structured log entries.

--
Álvaro Herrera Valdivia, Chile — https://www.EnterpriseDB.com/
"The problem with the facetime model is not just that it's demoralizing, but
that the people pretending to work interrupt the ones actually working."
(Paul Graham)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2021-08-19 13:07:27 Re: elog.c query_id support vs shutdown
Previous Message Andres Freund 2021-08-19 12:57:56 Re: NAMEDATALEN increase because of non-latin languages