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.92) (envelope-from ) id 1jDWJV-0000VU-EH for pgsql-general@arkaria.postgresql.org; Sun, 15 Mar 2020 16:40:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jDWJU-00062m-0E for pgsql-general@arkaria.postgresql.org; Sun, 15 Mar 2020 16:40:32 +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 1jDWJT-00060x-K1 for pgsql-general@lists.postgresql.org; Sun, 15 Mar 2020 16:40:31 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jDWJQ-0001N7-Ik for pgsql-general@lists.postgresql.org; Sun, 15 Mar 2020 16:40:31 +0000 Received: by mail-wm1-x344.google.com with SMTP id 25so15075449wmk.3 for ; Sun, 15 Mar 2020 09:40:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=9UnhCDqUoDkv1ZjYg0CQFZUs0ZhnUnpffHoOB8WHlbQ=; b=KFmsg9EV6ZWhHLm7eljQpTkogPzMNrT8J2zofze3GvpQ3t2CQJVuvOU5zR3ZuYC+4P Ns3vG3jFPyIarUl8RDvCp3xUCfm9tvl4uYU+lrFW/oTplw+zw2R5vuPq3F76/Qlu2t/9 f3dAWSA/q5sSUj/w/OQw83Zb+eGysLCmc7FQ3ISuueXkGlkIfdWVeLOX3slpm0w+cv6u E7hAij51IeeI383TSpwNGZqE0EuZqylvuXilLQPdD16Q/jQomGAOFbxxAZNqh9285FU4 uZ03/RJxs5Hr9EiHUn/I7VkSnkriZmKK7heTi+R3f6fTclJYVeVXR5dEZeBCJPP6ZIJ2 NEZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=9UnhCDqUoDkv1ZjYg0CQFZUs0ZhnUnpffHoOB8WHlbQ=; b=EWJw+dgd/JSnzTMfYk0JXKR+mRUMdHrZ8uGrDZY/4M8rVLdD2NZXQ535RAh+lrWIBv Mf1HGyy9pz9+l80q/V9HLQgZoaDag5UVch+gqqVbzrjLkkN+iSiAMnreUMeupWgLujcg Hb0zB+C9+2BWAsDfLcORNeTH7Q7szKpRHpnnQAvAl54syMXk7Wnjv795jWj8+2g26Wei yZz7Re4amQeEwmUusheIW+HmrdsVVwxXQ4olyZq3nCiNuOZ3Yp2+JxTq6Zoh60OKkUN2 fAlb6Xti+tqhoKnEB0kz2hQghVZCeGAnnGuW1GkKgOxaQSPKSDOV6lU/5VBVf1qyO67D Id2A== X-Gm-Message-State: ANhLgQ054UqvIBJr52ig81CtGimxf2Phb6nfLtTSsu9cmTPQB+Hjg6b2 qcF8H0od15W9p87URMUU6Oc= X-Google-Smtp-Source: ADFU+vtWImH74/VYqV6JyaqoKy87Cia7CEL3yxT0S2bozUZEtzdGYcWcsY6LLAJMK55C4zEzp/EFTQ== X-Received: by 2002:a1c:3d6:: with SMTP id 205mr24167252wmd.155.1584290426437; Sun, 15 Mar 2020 09:40:26 -0700 (PDT) Received: from [192.168.1.8] (241-57-239-77.dyn.cable.fcom.ch. [77.239.57.241]) by smtp.gmail.com with ESMTPSA id p15sm8812670wro.68.2020.03.15.09.40.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Mar 2020 09:40:25 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\)) Subject: Re: Exclude logging certain connections? From: =?utf-8?Q?Paul_F=C3=B6rster?= In-Reply-To: <6f368b1c-2422-90bf-012d-9c8162b8fb50@aklaver.com> Date: Sun, 15 Mar 2020 17:40:25 +0100 Cc: pgsql-general Content-Transfer-Encoding: quoted-printable Message-Id: References: <1CF8C28E-A9B9-44F6-A849-B3898B8AEAF5@gmail.com> <6f368b1c-2422-90bf-012d-9c8162b8fb50@aklaver.com> To: Adrian Klaver X-Mailer: Apple Mail (2.3608.60.0.2.5) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Adrian, > Nothing from what I see: >=20 > =46rom here: >=20 > https://www.postgresql.org/docs/12/config-setting.html#id-1.6.6.4.5 >=20 > env PGOPTIONS=3D"-c log_connections=3Doff" psql -d test -U aklaver >=20 > psql: error: could not connect to server: FATAL: permission denied to = set parameter "log_connections" >=20 > First problem is you need to be superuser. Alright so be superuser: >=20 > date > Sun Mar 15 09:24:20 PDT 2020 >=20 > aklaver@maura:~> env PGOPTIONS=3D"-c log_connections=3Doff" psql -d = test -U postgres >=20 > psql (12.1) > Type "help" for help. >=20 > test=3D# \x > Expanded display is on. > test=3D# select * from pg_settings where name =3D 'log_connections'; > -[ RECORD 1 ]---+------------------------------------ > name | log_connections > setting | off > unit | > category | Reporting and Logging / What to Log > short_desc | Logs each successful connection. > extra_desc | > context | superuser-backend > vartype | bool > source | client > min_val | > max_val | > enumvals | > boot_val | off > reset_val | off > sourcefile | > sourceline | > pending_restart | f >=20 >=20 > The connection is still recorded: >=20 > [unknown]-[unknown]-2020-03-15 09:24:23.460 PDT-0LOG: connection = received: host=3D[local] > [unknown]-postgres-2020-03-15 09:24:23.460 PDT-0LOG: connection = authorized: user=3Dpostgres database=3Dtest application_name=3Dpsql >=20 >=20 > To me it looks like log_connections is all or none. that's what I suspected. This is also what I found out so far. This is = ugly because unwanted monitoring connections like those of pgwatch2 keep = spamming the logfiles this way. It would be great if there was an option = to specify a list of users whose connections would not be logged, even = with logging connect/disconnect enabled. Something like this: log_exclude_user_connect =3D 'pgwatch2,myself,...' in postgresql.conf Thanks very much. Cheers, Paul=