How can I change the log directory from PostgreSQL 12? I need to change the default /var/log/ location to point to another disk location.
Asked
Active
Viewed 1,284 times
0
-
https://www.postgresql.org/docs/current/runtime-config-logging.html#GUC-LOG-DIRECTORY – Jun 29 '20 at 13:31
-
The default depends on what the packager who packaged your distribution decided to do. So, how did you install PostgreSQL? (If you build from source, the default is not /var/log). – jjanes Jun 29 '20 at 13:54
1 Answers
0
Edit postgresql.conf
, set logging_collector = on
(if it isn't already set that way) and change log_directory
appropriately.
Then restart PostgreSQL (if you didn't change logging_collector
, then a reload is enough).

Laurenz Albe
- 209,280
- 17
- 206
- 263
-
I've tried this but the location in log_directory as default is logs. and when I change it points to a different location and postgre goes down – Shagoon Jun 29 '20 at 13:35
-
Per the comment on your question, how did you install Postgres and on what OS version? My guess is you are fighting the packagers script that sets the logging directory. – Adrian Klaver Jun 29 '20 at 14:16