0

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:

[root@k8smasterone 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?

1
  • @a_horse_with_no_name but he did set it in postgresql.conf.
    – jjanes
    Commented Jul 30, 2022 at 0:43

1 Answer 1

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();

Your Answer

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

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