pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #19025: PostgreSQL log is not rotated
4+ messages / 4 participants
[nested] [flat]

* BUG #19025: PostgreSQL log is not rotated
@ 2025-08-19 10:21  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 3 replies; 4+ messages in thread

From: PG Bug reporting form @ 2025-08-19 10:21 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: jose.morcillo.valenciano@gmail.com

The following bug has been logged on the website:

Bug reference:      19025
Logged by:          José Antonio Morcillo Valenciano
Email address:      jose.morcillo.valenciano@gmail.com
PostgreSQL version: 16.2
Operating system:   Red Hat Enterpr Linux 5.14.0-427.35.1.el9_4.x86_64
Description:        

Hi folks!

We have configured our log rotating policy as follows:

logging_collector = on
log_destination = 'stderr'
log_directory = '/postgresql/16/log/cpdm-cluster86'
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_rotation_age = 1d
log_rotation_size = 250MB
log_truncate_on_rotation = on

But the log is 16GB and no rotation has happened:

[PRO] $ ls -lh
total 16G
-rw-r--r-- 1 postgres postgres 16G Aug 19 12:16
postgresql-2025-07-12_001207.log


I have been searching any bug but I could not find it. Any ideas?

Thanks!!!

Regards,
José Antonio



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

* Re: BUG #19025: PostgreSQL log is not rotated
@ 2025-08-19 13:41  Euler Taveira <euler@eulerto.com>
  parent: PG Bug reporting form <noreply@postgresql.org>
  2 siblings, 0 replies; 4+ messages in thread

From: Euler Taveira @ 2025-08-19 13:41 UTC (permalink / raw)
  To: jose.morcillo.valenciano@gmail.com; pgsql-bugs@lists.postgresql.org

On Tue, Aug 19, 2025, at 7:21 AM, PG Bug reporting form wrote:
> We have configured our log rotating policy as follows:
>
> logging_collector = on
> log_destination = 'stderr'
> log_directory = '/postgresql/16/log/cpdm-cluster86'
> log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
> log_rotation_age = 1d
> log_rotation_size = 250MB
> log_truncate_on_rotation = on
>
> But the log is 16GB and no rotation has happened:
>
> [PRO] $ ls -lh
> total 16G
> -rw-r--r-- 1 postgres postgres 16G Aug 19 12:16
> postgresql-2025-07-12_001207.log
>

Did the log say something? I'm wondering if the log_directory has the right
permission.

Are you sure that you reload and/or restart the service after changing these
parameters? Most of them require a reload but logging_collector requires a
restart.

You enable log_truncate_on_rotation but there won't be another log file with
the same name. Hence, no truncate will occur. The truncation only occurs due to
time-based rotation.

You are using an outdated version (16.2). The current minor version is 16.10.
You are ignoring 1.5 year of fixes. A minor version doesn't add new features;
it only adds bug fixes and security fixes.


-- 
Euler Taveira
EDB   https://www.enterprisedb.com/





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

* Re: BUG #19025: PostgreSQL log is not rotated
@ 2025-08-19 20:30  Rahila Syed <rahilasyed90@gmail.com>
  parent: PG Bug reporting form <noreply@postgresql.org>
  2 siblings, 0 replies; 4+ messages in thread

From: Rahila Syed @ 2025-08-19 20:30 UTC (permalink / raw)
  To: jose.morcillo.valenciano@gmail.com; pgsql-bugs@lists.postgresql.org

Hi,


> logging_collector = on
> log_destination = 'stderr'
> log_directory = '/postgresql/16/log/cpdm-cluster86'
> log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
> log_rotation_age = 1d
> log_rotation_size = 250MB
> log_truncate_on_rotation = on
>
> But the log is 16GB and no rotation has happened:
>
> [PRO] $ ls -lh
> total 16G
> -rw-r--r-- 1 postgres postgres 16G Aug 19 12:16
> postgresql-2025-07-12_001207.log
>
>
> I have been searching any bug but I could not find it. Any ideas?
>
>
I haven't attempted to reproduce this yet. However, after reviewing the
code
and the comments in the postgresql.conf file,
it appears that this is possible when rotation is triggered by file size
and
log_truncation_on_rotation is 'on'
i.e logs may be appended to an existing file with the same name
instead of truncating the existing file.
This happens because truncation only occurs during time-based rotation.

Are you observing this behaviour when log_truncate_on_rotation is 'false' ?

Thank you,
Rahila Syed

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

* Re: BUG #19025: PostgreSQL log is not rotated
@ 2025-08-20 11:19  hubert depesz lubaczewski <depesz@depesz.com>
  parent: PG Bug reporting form <noreply@postgresql.org>
  2 siblings, 0 replies; 4+ messages in thread

From: hubert depesz lubaczewski @ 2025-08-20 11:19 UTC (permalink / raw)
  To: jose.morcillo.valenciano@gmail.com; pgsql-bugs@lists.postgresql.org

On Tue, Aug 19, 2025 at 10:21:28AM +0000, PG Bug reporting form wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      19025
> Logged by:          José Antonio Morcillo Valenciano
> Email address:      jose.morcillo.valenciano@gmail.com
> PostgreSQL version: 16.2
> Operating system:   Red Hat Enterpr Linux 5.14.0-427.35.1.el9_4.x86_64
> Description:        
> 
> Hi folks!
> 
> We have configured our log rotating policy as follows:
> 
> logging_collector = on
> log_destination = 'stderr'
> log_directory = '/postgresql/16/log/cpdm-cluster86'
> log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
> log_rotation_age = 1d
> log_rotation_size = 250MB
> log_truncate_on_rotation = on
> 
> But the log is 16GB and no rotation has happened:

Please connect to the db, and check what are values of these settings
*inside* db.

You can do it by doing:

SELECT
    name,
    setting,
    source,
    sourcefile,
    sourceline
FROM
    pg_settings
WHERE
    name IN = ANY ('{logging_collector,log_destination,log_directory,log_filename,log_rotation_age,log_rotation_size,log_truncate_on_rotation}'::text[]);

Best regards,

depesz






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


end of thread, other threads:[~2025-08-20 11:19 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-08-19 10:21 BUG #19025: PostgreSQL log is not rotated PG Bug reporting form <noreply@postgresql.org>
2025-08-19 13:41 ` Euler Taveira <euler@eulerto.com>
2025-08-19 20:30 ` Rahila Syed <rahilasyed90@gmail.com>
2025-08-20 11:19 ` hubert depesz lubaczewski <depesz@depesz.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox