My pgstartup.log has got big. I have renamed it, and can set up logrotate to do it automatically if need be, but of course the server is still writing to the open file. I'd rather not restart the server, if I can avoid it. Is there a way to tell the server to reopen the file? I wondered if either pg_reload_conf or pg_rotate_logfile would do it, but the former only does the config files, and the latter only does the true log file (i.e. not pgstartup.log).

1 Answer 1


You can try to use next config for logrotate. I think "copytruncate" does that You need.

/var/log/postgresql/pgstartup.log {
       rotate 7
  • A good point, I can use this functionality of logrotate to do this, thanks. I would still quite like to figure out if there is a way for postgres to do it itself though, so I can do it on an adhoc basis. Oct 21, 2019 at 9:30

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.