public inbox for [email protected]help / color / mirror / Atom feed
pgsql: Modularize log_connections output 5+ messages / 3 participants [nested] [flat]
* pgsql: Modularize log_connections output @ 2025-03-12 15:37 Melanie Plageman <[email protected]> 0 siblings, 1 reply; 5+ messages in thread From: Melanie Plageman @ 2025-03-12 15:37 UTC (permalink / raw) To: [email protected] Modularize log_connections output Convert the boolean log_connections GUC into a list GUC comprised of the connection aspects to log. This gives users more control over the volume and kind of connection logging. The current log_connections options are 'receipt', 'authentication', and 'authorization'. The empty string disables all connection logging. 'all' enables all available connection logging. For backwards compatibility, the most common values for the log_connections boolean are still supported (on, off, 1, 0, true, false, yes, no). Note that previously supported substrings of on, off, true, false, yes, and no are no longer supported. Author: Melanie Plageman <[email protected]> Reviewed-by: Bertrand Drouvot <[email protected]> Reviewed-by: Fujii Masao <[email protected]> Reviewed-by: Daniel Gustafsson <[email protected]> Discussion: https://postgr.es/m/flat/CAAKRu_b_smAHK0ZjrnL5GRxnAVWujEXQWpLXYzGbmpcZd3nLYw%40mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/9219093cab2607f34ac70612a65430a9c519157f Modified Files -------------- doc/src/sgml/config.sgml | 82 ++++++++++++- src/backend/libpq/auth.c | 9 +- src/backend/postmaster/postmaster.c | 1 - src/backend/tcop/backend_startup.c | 161 +++++++++++++++++++++++++- src/backend/utils/init/postinit.c | 3 +- src/backend/utils/misc/guc_tables.c | 21 ++-- src/backend/utils/misc/postgresql.conf.sample | 8 +- src/include/postmaster/postmaster.h | 1 - src/include/tcop/backend_startup.h | 29 +++++ src/include/utils/guc_hooks.h | 2 + src/test/authentication/t/001_password.pl | 38 ++++++ src/tools/pgindent/typedefs.list | 1 + 12 files changed, 331 insertions(+), 25 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Modularize log_connections output @ 2025-03-12 15:50 Daniel Westermann (DWE) <[email protected]> parent: Melanie Plageman <[email protected]> 0 siblings, 1 reply; 5+ messages in thread From: Daniel Westermann (DWE) @ 2025-03-12 15:50 UTC (permalink / raw) To: Melanie Plageman <[email protected]>; [email protected] <[email protected]> Hi, great, thanks for this. One question: >The current log_connections options are 'receipt', 'authentication', and >'authorization'. The empty string disables all connection logging. 'all' >enables all available connection logging. ... shouldn't this be added to tab completion as well? postgres=# alter system set log_connections TO DEFAULT postgres=# alter system set log_disconnections TO 0 1 DEFAULT FALSE NO OFF ON TRUE YES postgres=# alter system set log_disconnections TO Regards Daniel ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Modularize log_connections output @ 2025-03-12 16:07 Melanie Plageman <[email protected]> parent: Daniel Westermann (DWE) <[email protected]> 0 siblings, 1 reply; 5+ messages in thread From: Melanie Plageman @ 2025-03-12 16:07 UTC (permalink / raw) To: Daniel Westermann (DWE) <[email protected]>; +Cc: [email protected] <[email protected]> Thanks for taking a look! On Wed, Mar 12, 2025 at 11:50 AM Daniel Westermann (DWE) <[email protected]> wrote: > > > great, thanks for this. One question: > > >The current log_connections options are 'receipt', 'authentication', and > >'authorization'. The empty string disables all connection logging. 'all' > >enables all available connection logging. > > ... shouldn't this be added to tab completion as well? > > postgres=# alter system set log_connections TO DEFAULT Because it is now a string GUC, there isn't a facility for tab completion. Enum and boolean GUCs have a defined set of options which can be provided as options for tab completion. Because string GUCs don't have to have a set of defined options, they don't have tab completion (AFAIK). For example, you couldn't have a defined set of options for log_line_prefix. There are a subset of the string GUCs that do have predefined options which they validate in their check hooks. Many of these are GUCs which can accept some combination of options -- so they don't fit well into the enum GUC type (for example, debug_io_direct). While writing this feature, I did consider if we should add a new GUC type PGC_SET [1] which would back GUCs that accept any subset of a predefined set of options. This would allow us to have tab completion. I didn't end up doing this because I felt tab completion was the only advantage it would provide this patch and it would be a big code change, but it is definitely something to consider in the future. - Melanie [1] https://www.postgresql.org/message-id/CAAKRu_a5-7sUP%2BQ6YD5emQYS1w7ffBDUNf-NMbcxR-dpOdGehw%40mail.g... ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Modularize log_connections output @ 2025-03-12 16:36 Daniel Gustafsson <[email protected]> parent: Melanie Plageman <[email protected]> 0 siblings, 1 reply; 5+ messages in thread From: Daniel Gustafsson @ 2025-03-12 16:36 UTC (permalink / raw) To: Melanie Plageman <[email protected]>; +Cc: Daniel Westermann (DWE) <[email protected]>; [email protected] <[email protected]> > On 12 Mar 2025, at 17:07, Melanie Plageman <[email protected]> wrote: > > Thanks for taking a look! > > On Wed, Mar 12, 2025 at 11:50 AM Daniel Westermann (DWE) > <[email protected]> wrote: >> >> >> great, thanks for this. One question: >> >>> The current log_connections options are 'receipt', 'authentication', and >>> 'authorization'. The empty string disables all connection logging. 'all' >>> enables all available connection logging. >> >> ... shouldn't this be added to tab completion as well? >> >> postgres=# alter system set log_connections TO DEFAULT > > Because it is now a string GUC, there isn't a facility for tab > completion. This GUC also cannot be changed within a session which makes tab completion less useful. -- Daniel Gustafsson ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Modularize log_connections output @ 2025-03-13 05:46 Daniel Westermann (DWE) <[email protected]> parent: Daniel Gustafsson <[email protected]> 0 siblings, 0 replies; 5+ messages in thread From: Daniel Westermann (DWE) @ 2025-03-13 05:46 UTC (permalink / raw) To: Daniel Gustafsson <[email protected]>; Melanie Plageman <[email protected]>; +Cc: [email protected] <[email protected]> Hi, >> On Wed, Mar 12, 2025 at 11:50 AM Daniel Westermann (DWE) >> <[email protected]> wrote: >>> >>> >>>> great, thanks for this. One question: >>> >>>> The current log_connections options are 'receipt', 'authentication', and >>> 'authorization'. The empty string disables all connection logging. 'all' >>> enables all available connection logging. >> >> ... shouldn't this be added to tab completion as well? >> >> postgres=# alter system set log_connections TO DEFAULT > > Because it is now a string GUC, there isn't a facility for tab > completion. Thank you both for the explanations. Regards Daniel ^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2025-03-13 05:46 UTC | newest] Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2025-03-12 15:37 pgsql: Modularize log_connections output Melanie Plageman <[email protected]> 2025-03-12 15:50 ` Daniel Westermann (DWE) <[email protected]> 2025-03-12 16:07 ` Melanie Plageman <[email protected]> 2025-03-12 16:36 ` Daniel Gustafsson <[email protected]> 2025-03-13 05:46 ` Daniel Westermann (DWE) <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox