0

I've gone through the postgres documentation and I've enabled the logging using the below configuration settings

log_statement = 'none'
log_min_duration_statement = 500
logging_collector = on
log_directory = '/var/postgreslog'
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_truncate_on_rotation = on
log_rotation_age = 1d
log_file_mode = 0600

When I looked at the documentation to check how these log files are retained, I found the below information

Note that all the solutions described above take care of starting new log files at configurable intervals, but they do not handle the deletion of old, no-longer-useful log files. You will probably want to set up a batch job to periodically delete old log files. Another possibility is to configure the rotation program so that old log files are overwritten cyclically.

I've selected the log file name with the combination of Year month date and timestamp and rotating the logs daily, so how many old log files gets retained?

2
  • 1
    "so how many old log files gets retained?" - all of them. As the part from the manual that you quoted explains: Postgres never deletes log files. You will get a new logfile every day. Commented Mar 2, 2022 at 12:53
  • When will the cycle of years start over? Commented Mar 2, 2022 at 15:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.