Re: control max length of parameter values logged

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alexey Bashtanov <bashtanov(at)imap(dot)cc>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: control max length of parameter values logged
Date: 2020-03-12 15:53:42
Message-ID: 20200312155342.GA9741@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020-Mar-11, Tom Lane wrote:

> Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> > Maybe it would make sense to always log complete parameters for error
> > cases when that feature is enabled, and have the GUC only control the
> > lengths logged for non-error cases?
>
> I could get behind that. It's a bit different from the original
> idea here, but I think it's closer to being real-world-useful.
>
> Another way to slice this up would be to have a USERSET GUC that
> controls truncation of parameter values in errors, and a separate
> SUSET GUC that controls it for the non-error statement logging
> cases. I'm not sure how much that's actually worth, but if we
> feel that truncation in error cases can be useful, that's how
> I'd vote to expose it.

Either of these ideas work for me. I think I like the latter more,
since it allows to configure truncation in all cases. (I'm not really
sure I understand why one of them must be SUSET.)

The reason I'm so hot about parameter truncation is that we've seen
cases where customers' log files contain log lines many megabytes long
because of gigantic parameters; UUID arrays with tens of thousands of
entries, and such. Sometimes we see those in the normal "statement"
line because $customer interpolates into the query literal; normally the
"solution" is to move the params from interpolated into a parameter.
But if we log all parameters whole, that workaround no longer works, so
a way to clip is necessary.

I agree that truncating the value that can be disabled while not
truncating the values that cannot be disabled, is a bit silly.

I'm okay with the default being not to clip anything.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-03-12 16:01:24 Re: control max length of parameter values logged
Previous Message Alvaro Herrera 2020-03-12 15:50:17 Re: [Patch] pg_rewind: options to use restore_command from recovery.conf or command line