April 2015
Intermediate to advanced
504 pages
11h 41m
English
PostgreSQL can generate gigabytes of logs per day. Lots of data is good if you want to investigate some specific event, but it is not what you will use for daily monitoring of database health.
In this recipe, we'll see how to perform a post analysis of our log files and get reports (and insights) about what has happened in a given period of time.
PostgreSQL 9.2 enhances real-time analysis of queries through the pg_stat_statements extension, which will be covered in the next recipe.
Make sure that your PostgreSQL is set up to rotate the log files, for example, daily. I personally prefer to integrate PostgreSQL with rsyslog and logrotate for log management on Linux or Unix systems, but you can ...