Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1egC66-0007LL-5H for pgsql-general@arkaria.postgresql.org; Mon, 29 Jan 2018 16:15:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1egC65-0007Qo-1Q for pgsql-general@arkaria.postgresql.org; Mon, 29 Jan 2018 16:15:53 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1egC64-0007Qd-Jr for pgsql-general@lists.postgresql.org; Mon, 29 Jan 2018 16:15:52 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1egC61-0002s0-V5 for pgsql-general@postgresql.org; Mon, 29 Jan 2018 16:15:51 +0000 Received: from bruce by momjian.us with local (Exim 4.84_2) (envelope-from ) id 1egC61-00014X-0p; Mon, 29 Jan 2018 11:15:49 -0500 Date: Mon, 29 Jan 2018 11:15:49 -0500 From: Bruce Momjian To: Popov Aleksey Cc: "pgsql-general@postgresql.org" Subject: Re: [GENERAL] Matching statement and duration log lines Message-ID: <20180129161549.GD11620@momjian.us> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 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 +