O'Reilly logo

PostgreSQL 9 Administration Cookbook - Second Edition by Simon Riggs, Gianni Ciolli, Hannu Krosing, Gabriele Bartolini

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required