Truncate logs by max_log_size

Kirill Gavrilov <diphantxm@gmail.com>

From: diPhantxm <diphantxm@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Date: 2024-09-26T18:30:08Z
Lists: pgsql-hackers

Attachments

Hi hackers,

I would like to suggest a patch to truncate some long queries. I believe
sometimes there is no need to log a query containing some gigabytes of
blob, for example. In patch a new parameter, named max_log_size, is
introduced. It defines the maximum size of logged query, in bytes.
Everything beyond that size is truncated.

Best regards,
Kirill Gavrilov

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix log_statement_max_length test with verbose logs

  2. Add log_statement_max_length GUC to limit logged statement text

  3. Improve user control over truncation of logged bind-parameter values.