Where are Postgresql 9.1 logs? (not starting on FreeBSD 10)

I tried finding solutions, but nothing helps.

I need to do a backup of my pgsql data from the app, I haven't used for months now. I have discovered, that the postgresql server is not running. But cannot start it.

I run pg_ctl -D /usr/local/pgsql/data -l logging.log -w -s start as pgsql user (su pgsql). Output says that it couldn't start a server and tells me to check logs. But logging.log is an empty file. Any default logging file I have found on the web about is modified months ago or empty or even doesn't exist.

I have no idea how to find the error, since logs are empty or I just don't know where to look for them.

Important note: it was working few months ago, but there were almost no changes in that time (possible hostname change).

Upvotes: 6

Views: 2977

Answers (2)

Lucas Holt
Lucas Holt

Reputation: 3826

Some versions of FreeBSD ports installed PostgreSQL with syslog logging enabled. You can confirm this by looking at /usr/local/pgsql/data/postgresql.conf for log_destination = 'syslog'

If that is the case, the logging output should be visible in /var/log/messages

Upvotes: 6

Viacheslav aka Lordz
Viacheslav aka Lordz

Reputation: 180

Default syslog logging enabled (log_destination = 'syslog') and logging output should be visible in /var/log/messages.

If you want to make a log in a separate file:

1) Create log file:

touch /var/log/postgresql/postgresql.log

2) Edit /etc/syslog.conf, append lines

!postgres
*.*                                             /var/log/postgresql/postgresql.log
!*

After editing, you need to restart the service

service syslogd restart

4) do not forget to rotate postgresql.log (edit /etc/newsyslog.conf)

5) Perhaps in order to see something you will need to set the logging level. As an example, add to your postgresql.conf

client_min_messages = log
log_min_messages = info

log_checkpoints = on
log_connections = on
log_disconnections = on

Upvotes: 0

Related Questions