May 2018
Intermediate to advanced
576 pages
30h 25m
English
Both log_statement and pgaudit output audit log records to the server log. This is the most flexible approach since the log can be routed in various ways to ensure it is safe and separate from normal log entries.
If you allow the log entries to go the normal server log you can find all occurrences of the CREATE, ALTER, and DROP commands in the log:
postgres@hvost:~$ egrep -i “create|alter|drop” \/var/log/postgresql/postgresql-9.6-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 settings in the postgresql.conf file for log rotation are as follows:
log_filename ...