Re: Proposal: Adding json logging

From: Ryan Pedela <rpedela(at)datalanche(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: David Fetter <david(at)fetter(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David Arnold <dar(at)xoe(dot)solutions>, Craig Ringer <craig(at)2ndquadrant(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Proposal: Adding json logging
Date: 2018-04-14 23:02:21
Message-ID: CACu89FQYYfH28GgHv10taiU5+Jijg=TnVjDsBKTAnx-7Wt67kw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Apr 14, 2018, 4:33 PM Andres Freund <andres(at)anarazel(dot)de> wrote:

> On 2018-04-15 00:31:14 +0200, David Fetter wrote:
> > On Sat, Apr 14, 2018 at 01:20:16PM -0700, Andres Freund wrote:
> > > On 2018-04-14 18:05:18 +0200, David Fetter wrote:
> > > > CSV is very poorly specified, which makes it at best complicated to
> > > > build correct parsing libraries. JSON, whatever gripes I have about
> > > > the format[1] is extremely well specified, and hence has excellent
> > > > parsing libraries.
> > >
> > > Worth to notice that useful json formats for logging also kinda don't
> > > follow standards. Either you end up with entire logfiles as one big
> > > array, which most libraries won't parse and makes logrotate etc really
> > > complicated, or you end up with some easy to parse format where
> newlines
> > > have non-standard record separator meaning.
> >
> > I don't see this as a big problem. The smallest-lift thing is to put
> > something along the lines of:
> >
> > When you log as JSON, those logs are JSON objects, one per output
> > event. They are not guaranteed to break on newlines.
> >
> > A slightly larger lift would include escaping newlines and ensuring
> > that JSON output is always single lines, however long.
>
> Still obliterates your "standard standard standard" line of
> argument. There seem to valid arguments for adding json regardless, but
> that line is just bogus.
>
> Greetings,
>
> Andres Freund
>

The format is known as JSON Lines.
http://jsonlines.org/

Ryan

>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jordan Deitch 2018-04-14 23:24:36 Re: Proposal: Adding json logging
Previous Message Andres Freund 2018-04-14 22:33:02 Re: Proposal: Adding json logging