Thanks...I got the same info from postgrespro after searching this for long time..
Can we also set for one month the same way?
Thanks.
On Tue, 19 Mar 2024, 13:50 Gabriel Guillem Barceló Soteras, <gbarcelo@xxxxxxxxxxxxxx> wrote:
I think it is the default behaviour on default install:
- Edit the postgresql.conf File:
- Locate the postgresql.conf file for your PostgreSQL installation.
- Configure the Following Parameters:
- Set log_filename to server_log.%a. This will create one log file per day named server_log.Mon, server_log.Tue, etc.
- Enable log_truncate_on_rotation to automatically overwrite last week’s log with this week’s log.
- Set log_rotation_age to 1440 (minutes), which corresponds to 24 hours. This ensures that logs are rotated daily.
- Example Configuration:
log_filename = 'server_log.%a'
log_truncate_on_rotation = on
log_rotation_age = 1440
Still keep an eye on log_rotation_size
After making these changes, restart your PostgreSQL server for the new settings to take effect.