[Pkg-postgresql-public] Bug#791556: pg_createcluster --logfile $dir should warn/behave better

Christoph Berg myon at debian.org
Mon Jul 6 08:32:52 UTC 2015

Package: postgresql-common

Re: Stefan De Wachter 2015-07-05 <CAGiaxKR=1P++-PSotM5ExnugiOerQ=V8Wt=Mfmd7Fk8G-haK+Q at mail.gmail.com>
> Thank you very much for your email. The symlink /etc/postgresql/9.4/main/log
> points to /data/postgresql/log, which is the log directory I set up in
> postgresql.conf. When I was messing around with the pg_ctlcluster script, I
> found that an error was generated which said exactly that (it's a
> directory, not a file), but that error message was redirected to /dev/null.
> So what you see on the console is just something saying startup failed, but
> nothing more informative.
> The question, then, is why the symlink is pointing to a directory in the
> first place, and why it worked before but not after the upgrade. Digging
> through my notes, I *think* that I originally set up the cluster using the
> command
> pg_createcluster -d /data/postgresql/db --logfile /data/postgresql/log 9.4
> main

Hi Stefan,

you should point this to a real file (and set up logrotate style

When pointing --logfile to a directory I get this here:

$ mkdir /tmp/log
$ pg_createcluster --logfile /tmp/log 9.4 foo
$ l /tmp/log/ -d
drw-r----- 2 postgres postgres 4096 Jul  6 10:10 /tmp/log//
$ l /etc/postgresql/9.4/foo/log
lrwxrwxrwx 1 postgres postgres 8 Jul  6 10:10 /etc/postgresql/9.4/foo/log -> /tmp/log/

The garbled permissions mean that pg_createcluster really didn't
understand what we wanted it to do there.

> which is probably why things went wrong (guess the word logfile ought to
> have made me wonder, but then, I'm an idiot so it can't be helped). Why it
> did work before the update, though, I don't know. Perhaps the update set
> the symlink but it wasn't there before for some reason?

You probably tweaked the permissions, or (re)created the directory
only later.

> You think it is best to just delete that symlink? From what you say, it
> should then write the early startup log to the default /var/log/postgresql
> folder?

You can either delete the symlink to make it log to
/var/log/postgresql/...log, or point it to a file inside

What we should do on the pg_*cluster side is to make the tools
complain when someone points --logfile to a directory. (Or, possibly
better, automatically append "postgresql-$ver-$cluster.log to the
directory.) Cc'ing the BTS so we don't forget.

cb at df7cb.de | http://www.df7cb.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-postgresql-public/attachments/20150706/5a0f18b7/attachment.sig>

More information about the Pkg-postgresql-public mailing list