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

From Magnus Hagander
Subject Re: Proposal: More structured logging
Date
Msg-id CABUevEyMvoZobp=c+wHgGoF3emaxF4pZyQnvm=ysmVP5sRjM9g@mail.gmail.com
Whole thread Raw
In response to Re: Proposal: More structured logging  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: Proposal: More structured logging  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
On Thu, Aug 19, 2021 at 3:04 PM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
>
> 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.

+1. I think having the ability to natively send structured data to
journald would be useful.

Another thing I've noticed in more and more other products is to be
able to log as json, which is then later thrown into a central logging
system somewhere. Basically like csv, but with the schema defined in
each row. Yes, a lot more overhead, but some systems really do like to
consume json.... So when we're on the topic of more structured
logging...

--
 Magnus Hagander
 Me: https://www.hagander.net/
 Work: https://www.redpill-linpro.com/



pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: Push down time-related SQLValue functions to foreign server
Next
From: Tom Lane
Date:
Subject: Re: Allow declaration after statement and reformat code to use it