This recipe shows you how you can collect Data Definition Language (DDL) from database logs in order to audit changes to the database structure.
postgresql.conf file to set the following:
log_statement = 'ddl'
Setting it to
all is also OK for this. Don't forget to reload the configuration:
Now find all occurrences of the
DROP commands in the log:
postgres@hvost:~$ egrep -i "create|alter|drop" \ /var/log/postgresql/postgresql-9.4-main.log
If log rotation is in effect, you may need to use grep on older logs as well.
If the available logs are too new, and you haven't saved the older logs in some other place, you are out of luck.
The default ...