does postgresql 13 support the log rotate hot reload

All we need is an easy explanation of the problem, so here it is.

I changed the log config in server postgres.conf file like this:

log_filename = 'postgresql-%i.log'

then I execute this command in server side:

pg_ctl reload;

the new log file name seems did not generate, is it possible to hot reload this config and make effect? I also have run this command:

SELECT pg_reload_conf();

the log still look like this:

[[email protected] log]# ls -alh
total 368M
drwx------  2 1000 1000 4.0K Jul 29 08:00 .
drwx------ 20 1000 1000 4.0K Jul 29 18:59 ..
-rw-------  1 1000 1000  81M Jul 28 08:00 postgresql-2022-07-27_143753.log
-rw-------  1 1000 1000  53M Jul 28 14:10 postgresql-2022-07-28_000000.log
-rw-------  1 1000 root 140M Jul 29 08:00 postgresql-2022-07-28_061040.log
-rw-------  1 1000 root  95M Jul 29 19:03 postgresql-2022-07-29_000000.log

did I have to restart the postgresql server?

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

reloading the config files will cause PostgreSQL to start using the new pattern. So the next time the log rotates, it will use that pattern. But it doesn’t cause a rotate to happen when it otherwise would not, so there will be no immediate visible evidence it is using a new pattern. You would need to trigger a rotate separately (after doing the reload)

select pg_rotate_logfile();

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply