2

I’m using Postgres 9.5 on Ubuntu 14.04. I notice I’m generating a lot of Postgres logs in

/var/log/postgresql/postgresql-9.5-main.log

. I would like to limit the size of this file, and doing some time based rotation (e.g. daily) is not an option. Is there any way I can tell Postgres to rotate its logs once they reach a certain size?

asked Dec 29, 2016 at 17:10
1

1 Answer 1

4

The PostgreSQL Error reporting and logging documentation states:

log_rotation_size (integer)

When logging_collector is enabled, this parameter determines the maximum size of an individual log file. After this many kilobytes have been emitted into a log file, a new log file will be created. Set to zero to disable size-based creation of new log files. This parameter can only be set in the postgresql.conf file or on the server command line.

So, I guess you should set this parameter to the desired value. My postgresql.conf option has the default values:

#log_rotation_size = 10MB # Automatic rotation of logfiles will 
 # happen after that much log output. 
 # 0 disables. 
answered Dec 29, 2016 at 21:31
2
  • I set this but it is still not rotating the logs .. maybe I there is something else I need to do besides restarting the PostGres server? Commented Dec 29, 2016 at 23:39
  • 1
    Is logging_collector enabled ? Commented Dec 30, 2016 at 18:13

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.