Re: Proposal: More structured logging - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Proposal: More structured logging
Date
Msg-id 202108191304.u7g5wwuepwpe@alvherre.pgsql
Whole thread Raw
In response to Proposal: More structured logging  (Ronan Dunklau <ronan.dunklau@aiven.io>)
Responses Re: Proposal: More structured logging  (Magnus Hagander <magnus@hagander.net>)
Re: Proposal: More structured logging  (Ronan Dunklau <ronan.dunklau@aiven.io>)
List 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)



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: NAMEDATALEN increase because of non-latin languages
Next
From: Julien Rouhaud
Date:
Subject: Re: elog.c query_id support vs shutdown