Re: Truncate logs by max_log_size - Mailing list pgsql-hackers

From Euler Taveira
Subject Re: Truncate logs by max_log_size
Date
Msg-id 94d53a41-d1f5-4fd1-8d1e-ff36ac569848@app.fastmail.com
Whole thread Raw
Responses Re: Truncate logs by max_log_size
List 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

pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Pgoutput not capturing the generated columns
Next
From: Fujii Masao
Date:
Subject: Re: Modify comment in /postgres/src/bin/pg_walsummary/nls.mk