At Tue, 26 Oct 2021 09:39:12 -0400, Tom Lane <t...@sss.pgh.pa.us> wrote in 
> Kyotaro Horiguchi <horikyota....@gmail.com> writes:
> > I noticed that the following command doesn't leave connection log in
> > log file.
> >> psql "host=localhost options=-c\ log_connections=on"
> 
> [ shrug... ]  Why would you expect it to?  Should "-c log_connections=off"
> be able to hide a connection from the log?

I don't know. The fact is that it's a superuser-backend variable that
is silently ignored (but acutally seems to be set in the session).
Setting log_disconnection the same way works (of course the impliction
of this is far less significant that the log_connection case).

If we want to refuse them to be set at session start (and I think so),
shouldn't they be changed to SIGHUP? (I forgot to mention this choice
in the previous mail..)

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index e91d5a3cfd..57d810c80d 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -1353,7 +1353,7 @@ static struct config_bool ConfigureNamesBool[] =
 		NULL, NULL, NULL
 	},
 	{
-		{"log_connections", PGC_SU_BACKEND, LOGGING_WHAT,
+		{"log_connections", PGC_SIGHUP, LOGGING_WHAT,
 			gettext_noop("Logs each successful connection."),
 			NULL
 		},
@@ -1362,7 +1362,7 @@ static struct config_bool ConfigureNamesBool[] =
 		NULL, NULL, NULL
 	},
 	{
-		{"log_disconnections", PGC_SU_BACKEND, LOGGING_WHAT,
+		{"log_disconnections", PGC_SIGHUP, LOGGING_WHAT,
 			gettext_noop("Logs end of a session, including duration."),
 			NULL
 		},

Reply via email to