Log Rotation Documentation Update

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: tom(dot)swartz(at)crunchydata(dot)com
Subject: Log Rotation Documentation Update
Date: 2019-10-23 16:00:11
Message-ID: 157184641143.26620.17338358043488452407@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/12/runtime-config-logging.html
Description:

Hi all:

We recently ran into an unusual case where the following occurred:
- PG log directory is a separate filesystem from PG data and other
operations-critical data.
- PG logs directory filled to 100% usage due to outside circumstances (PG
continued functioning, despite logging issues)
- Once disk usage issue was resolved (disk space was again available), the
log file would not rotate on time/size based triggers and would continue to
grow in size.
- Log rotation would only resume after issuing a SIGHUP

I believe that this case would be ideally documented
(https://www.postgresql.org/docs/current/runtime-config-logging.html), as
it's a valid state based on the code:

https://github.com/postgres/postgres/blob/c96581abe418a3bf64b643aa4e27091d1eaea1c1/src/backend/postmaster/syslogger.c

Specifically highlighting the sections:
```
/*
* If we had a rotation-disabling failure, re-enable rotation
* attempts after SIGHUP, and force one immediately.
*/
if (rotation_disabled)
{
rotation_disabled = false;
rotation_requested = true;
}
```

I will note that it is logged in PG Log output as noted below:
```
/*
* ENFILE/EMFILE are not too surprising on a busy system; just
* keep using the old file till we manage to get a new one.
* Otherwise, assume something's wrong with Log_directory and stop
* trying to create files.
*/
if (errno != ENFILE && errno != EMFILE)
{
ereport(LOG,
(errmsg("disabling automatic rotation (use SIGHUP to re-enable)")));
rotation_disabled = true;
}
```
However, it is also notable that because these logs are not rotated as
expected, one may not see the above error message unless they sort through a
log file on an unexpected date/time.
Further, I'm not sure how that message would ever even get logged if
rotation is halted due to disk filling up.

I believe this could be rectified by noting the situations where log
rotation would be disabled (such as the disk full state described) and the
action to resume log rotation (issue a SIGHUP to re-enable) in the
https://www.postgresql.org/docs/current/runtime-config-logging.html page.

Cheers,

Browse pgsql-docs by date

  From Date Subject
Next Message Bruce Momjian 2019-10-24 00:30:11 Re: Typo on Refresh Materialized View page
Previous Message Tuomas Leikola 2019-10-23 11:35:02 Re: uniqueness and null could benefit from a hint for dba