public inbox for [email protected]  
help / color / mirror / Atom feed
Re: Q: limit the length of log file entries?
2+ messages / 2 participants
[nested] [flat]

* Re: Q: limit the length of log file entries?
@ 2025-09-03 19:07  Tom Lane <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Tom Lane @ 2025-09-03 19:07 UTC (permalink / raw)
  To: Albrecht Dreß <[email protected]>; +Cc: [email protected]

Albrecht =?iso-8859-1?b?RHJl3w==?= <[email protected]> writes:
> I have a PL/PGsql DB function 'addval(_id text, _data bytea) RETURNS VOID'.  When a broken bytea is passed as 2nd parameter, something like

> albrecht@test FEHLER:  ungültige hexadezimale Ziffer: »r« bei Zeichen 28
> albrecht@test ANWEISUNG:  SELECT FROM addval('hopp', '\xbroken')

> is printed in the log file.  This is fine and very helpful in this case, but I have a “friendly user” who transmitted a broken hex string of ~100 KBytes as second parameter, resulting in a log line of this size which is not really readable and when done frequently quickly fills the logs.

There isn't any provision for limiting the length of source queries
quoted in the log.  Had your user sent the bytea value as a query
parameter, then log_parameter_max_length[_on_error] would have
applied, but this looks like the value was just inline in the query.

			regards, tom lane






^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Q: limit the length of log file entries?
@ 2025-09-04 15:48  Albrecht Dreß <[email protected]>
  parent: Tom Lane <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Albrecht Dreß @ 2025-09-04 15:48 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; +Cc: [email protected]

Am 03.09.25 21:07 schrieb(en) Tom Lane:
> There isn't any provision for limiting the length of source queries
> quoted in the log.

I see, thanks for the clarification.  IMHO, it would be nice to have such an option, though…

> Had your user sent the bytea value as a query
> parameter, then log_parameter_max_length[_on_error] would have
> applied, but this looks like the value was just inline in the query.

I can confirm that the limitation is applied when I call PQexecParams() from a little c test application with the data included in the paramValues array.  The overlong log lines result from queries in a Python script using the psycopg2 module – no idea how this component formats the query.

Thanks again,
Albrecht.

Attachments:

  [application/pgp-signature] openpgp-digital-signature.asc (488B, 2-openpgp-digital-signature.asc)
  download

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-09-04 15:48 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-09-03 19:07 Re: Q: limit the length of log file entries? Tom Lane <[email protected]>
2025-09-04 15:48 ` Albrecht Dreß <[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