How to change log directory location in postgresql 9.4?
So this is what I supposed :) You need to grant permissions to the new log directory to postgres user.
You can do this using f.e.:
sudo chown postgres:postgres /your/new/log/dir/path
Answering your other question:
To allow TCP/IP connections from remote hosts you need to edit pg_hba.conf
file.
You can allow ALL TCP/IP connections by adding a line like this:
host all all 0.0.0.0/32 md5
There are five parameters above, you can read about them in the pg_hba.conf file in the comments at the top of the file, but in short they mean:
[connection_type] [database_name] [user_name] [remote_ip/mask] [auth_type]
John doe
Beginner to coding. Interested in learning java. Some times my questions might be silly but i'm trying very hard to learn java coding
Updated on June 05, 2022Comments
-
John doe almost 2 years
my current log_directory path is
**/opt/demo/PostgreSQL/9.4/data/pg_log**
I'm trying to change the log directory path to
**/logs/demo/**
The server won't start when i uncomment the log path and it starts only when its default.
The postgresql.conf file looks like
# ERROR REPORTING AND LOGGING #------------------------------------------------------------------------------ # - Where to Log - log_destination = 'stderr' # Valid values are combinations of # stderr, csvlog, syslog, and eventlog, # This is used when logging to stderr: logging_collector = on # These are only used if logging_collector is on: #log_directory = '/logs/etbos/demo/' #directorywherelogfiles are written #log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern, # These are relevant when logging to syslog: #syslog_facility = 'LOCAL0' #syslog_ident = 'postgres' # This is only relevant when logging to eventlog (win32): #event_source = 'PostgreSQL'
-
jdabrowski about 8 yearsPlease add error logs, probably postgres user does not have sufficient privileges to acces new log directory.
-
John doe about 8 yearsThis is after i changed the log path 2016-03-09 16:41:43 EST FATAL: could not open log file "/logs/demo/postgresql-2016-03-09_164143.log": Permission denied
-
-
John doe about 8 yearsThanks a lot. It worked. Can you please tell How to enable tcp/ip connections to connect from pgadmin to the server? Please bear with me i'm a beginner.
-
John doe about 8 yearsThanks a lot @jdabrowski. Made my job a lot easier. Should it be 0.0.0.0/32 or 0.0.0.0/0?
-
jdabrowski about 8 yearsDepends on what you want to achieve, if you want to allow everything you can use
0
at the end :) -
John doe about 8 yearsThank you but even after i made changes in the pg_hba.conf.. Im still not able to connect to the database using pgadmin. It still says connection refused
-
jdabrowski about 8 yearsMaybe you're using wrong port to connect? The default is
5432
, but maybe you've changed it in postgresql.conf file? -
jdabrowski about 8 yearsAlso in postgresql.conf file you need to set
listen_addresses = '*'
. -
jdabrowski about 8 yearsYou have to check the connection then, make sure so firewall blocks it, etc.
-
John doe about 8 yearsYes, the firewall's blocking it. Thanks a lot.