Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1irMV3-0008Az-Of for pgsql-general@arkaria.postgresql.org; Tue, 14 Jan 2020 13:44:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1irMV1-0001we-CR for pgsql-general@arkaria.postgresql.org; Tue, 14 Jan 2020 13:44:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1irMV1-0001uf-2k for pgsql-general@lists.postgresql.org; Tue, 14 Jan 2020 13:44:51 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1irMUv-0000EF-LL for pgsql-general@lists.postgresql.org; Tue, 14 Jan 2020 13:44:50 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 00EDifst021031; Tue, 14 Jan 2020 08:44:41 -0500 From: Tom Lane To: "Zwettler Markus (OIZ)" cc: "pgsql-generallists.postgresql.org" Subject: Re: How to log pg_terminate_backend() calls In-reply-to: <7065c63d01944768bcfae1182301217d@zuerich.ch> References: <7065c63d01944768bcfae1182301217d@zuerich.ch> Comments: In-reply-to "Zwettler Markus (OIZ)" message dated "Tue, 14 Jan 2020 12:01:58 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <21029.1579009481.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 14 Jan 2020 08:44:41 -0500 Message-ID: <21030.1579009481@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "Zwettler Markus (OIZ)" writes: > We see some "FATAL: terminating connection due to administrator command= " error messages in the Postgres logfile. > We assume someone did pg_terminate_backend() calls. > How can we log such calls, especially who did the call? There's no built-in facility for that, short of log_statement =3D all. You could try making a wrapper function: rename pg_terminate_backend to something else and then make a plpgsql equivalent that issues RAISE LOG and then calls the renamed function. regards, tom lane