A while back I posted some SQL which helps track of changes to the PostgreSQL settings file. I've found it useful when benchmarking tests with different settings, but unfortunately the pg_settings_log() function needs to be run manually after each setting change. However that sounds like something which a custom background worker (new in 9.3) could handle - basically all the putative background worker would need to do is execute the pg_settings_log() function whenever the server starts (or restarts) or receives SIGHUP.

This turned out to be surprisingly easy to implement. Based off the example contrib module and Michael Paquier's excellent posts, this is the code. Basically all it does is check for the presence of the required database objects (a function and a table) on startup, executes pg_settings_log() on startup, and adds a signal handler for SIGHUP which also calls pg_settings_log().

To install this, download the package files (I'll try and get this on PGXN at some point) from the PGXNproject page; unpack; with the 9.3 pg_config in the shell path do make and make install. In the default postgres database, execute CREATE EXTENSION config_log then add config_log to postgresql.conf's shared_preload_libraries parameter and restart PostgreSQL.

The module will write something like the following into the PostgreSQL log:

To verify it catches changes which don't require a restart, change something in postgresql.conf (e.g. temp_buffers to 12MB) and execute "SELECT pg_reload_conf()" or "pgctl reload"; the log output will look something like this: