Producing a daily summary of log file errors
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.
Getting ready
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 ...
Get PostgreSQL 9 Administration Cookbook - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.