Re: Truncate logs by max_log_size
Euler Taveira <euler@eulerto.com>
From: "Euler Taveira" <euler@eulerto.com>
To: diPhantxm <diphantxm@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2024-09-27T00:30:05Z
Lists: pgsql-hackers
On Thu, Sep 26, 2024, at 3:30 PM, diPhantxm wrote: > 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. I don't know how useful is this proposal. IMO the whole query is usually crucial for an analysis. Let's say you arbitrarily provide max_log_size = 100 but it means you cannot see a WHERE clause and you have a performance issue in that query. It won't be possible to obtain the whole query for an EXPLAIN. It would break audit systems that requires the whole query. I don't know if there are some log-based replication systems but it would break such tools too. There are other ways to avoid logging such long queries. The GRANT ... ON PARAMETER and SET LOCAL commands are your friends. Hence, you can disable specific long queries even if you are not a superuser. If your main problem is disk space, you can adjust the rotation settings or have an external tool to manage your log files (or even use syslog). -- Euler Taveira EDB https://www.enterprisedb.com/
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix log_statement_max_length test with verbose logs
- 9bfbf5bf6190 master landed
-
Add log_statement_max_length GUC to limit logged statement text
- c8bd8387c27a master landed
-
Improve user control over truncation of logged bind-parameter values.
- 0b34e7d307e6 13.0 cited