Re: control max length of parameter values logged - Mailing list pgsql-hackers

From Justin Pryzby
Subject Re: control max length of parameter values logged
Date
Msg-id 20200401043659.GK14618@telsasoft.com
Whole thread Raw
In response to Re: control max length of parameter values logged  (Alexey Bashtanov <bashtanov@imap.cc>)
Responses Re: control max length of parameter values logged  (Alexey Bashtanov <bashtanov@imap.cc>)
List pgsql-hackers
Hi,

On Wed, Apr 01, 2020 at 01:52:48AM +0100, Alexey Bashtanov wrote:
> +++ b/doc/src/sgml/config.sgml
> +     <varlistentry id="guc-log-parameter-max-length" xreflabel="log_parameter_max_length">
> +      <term><varname>log_parameter_max_length</varname> (<type>integer</type>)
> +      <indexterm>
> +       <primary><varname>log_parameter_max_length</varname> configuration parameter</primary>
> +      </indexterm>
> +      </term>
> +      <listitem>
> +       <para>
> +        If greater than zero, bind parameter values reported in non-error
> +        statement-logging messages are trimmed to no more than this many bytes.

Can I suggest to say:

"Limit bind parameter values reported by non-error statement-logging messages
to this many bytes". Or,

"The maximum length of bind parameter values to log with non-error
statement-logging messages".

> --- a/src/backend/utils/misc/guc.c
> +++ b/src/backend/utils/misc/guc.c
> @@ -2855,6 +2857,28 @@ static struct config_int ConfigureNamesInt[] =
>          NULL, NULL, NULL
>      },
>  
> +    {
> +        {"log_parameter_max_length", PGC_SUSET, LOGGING_WHAT,
> +            gettext_noop("When logging statements, limit logged parameter values to first N bytes."),
> +            gettext_noop("Zero to print values in full."),

Could you make zero a normal value and -1 the "special" value to disable
trimming ?

Setting to zero will avoid displaying parameters at all, setting to -1 wil
display values in full.

Cheers,
-- 
Justin



pgsql-hackers by date:

Previous
From: "movead.li@highgo.ca"
Date:
Subject: Re: A bug when use get_bit() function for a long bytea string
Next
From: Andres Freund
Date:
Subject: wraparound dangers in snapshot too old