I have a standard Ubuntu postgres9.1 install running continuosly, I may not stop it.
Nothing has been specifically configured regarding the logging target,
so there is a (rotating somehow)
logfile /var/log/postgresqlpostgresql-9.1-main.log.
I suppose, it grabs the standard output of the processes.
What I want is to configure a different file target, and, without restart,
(Sorry, no collector, no syslog … those need restarting)
but with reconfig, the new child processes used that file.
Is that possible?
Thank you.
I’ve modified my previous answer because as Daniel Vérité pointed out, you can’t set the log file without using the
logging_collector, thelog_filenameoption will be ignored.Rotation is done through “copy-truncate”. That is logrotate makes a copy of the file and then empties the main log file.
In this case I think you will be lucky in that the server opens up a file handle to the log and uses just that one to write to. This means that you can simply rename the file
mv old_name.log new_name.log. The file handle that postgresql uses is bound to the file itself and not the name.This solution does come with the problem that when the server is restarted, it will create a new log file under the old name. You will need to make configuration changes so that when it restarts it continues to write to the same place.