How to configure Postgres to never rotate or truncate a log file?

221 Views Asked by At

I have a very very old Postgres version 9.2.23 DB that has very little log activity. I want to prevent any logs from being deleted. Currently the log_collector is configured to rotate the logs every day and truncate on rotation. Here are the current settings in /var/lib/pgsql/9.2/data/postgresql.conf:

log_filename = 'postgresql-%a.log'  
log_rotation_age = 1d
log_rotation_size = 0
log_truncate_on_rotation = on             

Here's my plan for re-configuring the logging so they're never deleted:

  1. Create a new log file: touch /var/lib/pgsql/9.2/data/pg_log/perpetual.log
  2. Set log_filename = 'perpetual.log'
  3. Set log_rotation_age = 0
  4. And just for good measure, set log_truncate_on_rotation = off
  5. Restart Postgres

Will this plan work? Is there an easier way?

0

There are 0 best solutions below