Re: [GENERAL] Matching statement and duration log lines

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Popov Aleksey <Aleksey(dot)Popov(at)annalect(dot)omd(dot)ru>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: [GENERAL] Matching statement and duration log lines
Date: 2018-01-29 16:15:49
Message-ID: 20180129161549.GD11620@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Oct 23, 2017 at 01:06:07PM +0000, Popov Aleksey wrote:
> Hello!
>
> I am sending PG logs to Elasticsearch and want to merge a line with statement
> and a line with duration into one document.
> Having a statement line and a duration line, can I assume that if a session ids
> (%c) of these lines match,
> and numbers of log lines (%l) are consecutive, then the duration line belongs
> to statement line?

Very late reply here, but setting log_min_duration_statement to zero
will give you those on one line, but the statement will only be output
when it completes, rather than when it starts, which is what
log_statement does.

And, yes, using %c to match up lines will work too.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Konstantin Gredeskoul 2018-01-29 16:16:22 Re: PG Sharding
Previous Message Steve Crawford 2018-01-29 16:12:18 Re: Which specific flags to use for bash client applications for DaVinci Resolve?