cloudfoundry-community/postgres-boshrelease

Make Logging Better

jhunt opened this issue · 1 comments

jhunt commented

The postgres job (and probably all the others too) doesn't log everything to the postgres.log file; in fact, only bits and pieces of output from the ctl script go there. Fix that with an exec up-top.

jhunt commented

I've verified that nothing goes to the monit_debugger, but the script could do more to make that apparent.

This ticket should also take care of the horrendous state of log contents:

waiting for server to start....LOG:  could not create IPv6 socket: Address family not supported by protocol
LOG:  database system was shut down at 2018-04-15 14:48:25 GMT
LOG:  MultiXact member wraparound protections are now enabled
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started
 done
server started
[repl:master] setting up replication
DO
[postgres] setting up user admin
ERROR:  role "admin" already exists
STATEMENT:  CREATE ROLE admin SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;
ERROR:  database "admin" already exists
STATEMENT:  CREATE DATABASE admin OWNER admin;
[postgres] setting up user user
ERROR:  role "user" already exists
STATEMENT:  CREATE ROLE "user" NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;
ERROR:  database "user" already exists
STATEMENT:  CREATE DATABASE "user" OWNER "user";
[postgres] setting up user jhunt
[postgres] setting up database animals
ERROR:  database "animals" already exists
STATEMENT:  CREATE DATABASE animals OWNER vcap;
ERROR:  role "porcupine" does not exist
STATEMENT:  GRANT ALL PRIVILEGES ON DATABASE "animals" TO "porcupine"
ERROR:  role "hedgehog" does not exist
STATEMENT:  GRANT ALL PRIVILEGES ON DATABASE "animals" TO "hedgehog"
ERROR:  could not open extension control file "/var/vcap/data/packages/postgres/9949e360d4519019a7082ff67d6e3f4bfb345222/share/extension/pgcypto.control": No such file or directory
STATEMENT:  CREATE EXTENSION IF NOT EXISTS pgcypto

Unless you are aware of how the script works, you wouldn't know that the "already exists" error is benign, but the pgcrypto errors are problematic.