Install and Configure pgBadger for PostgreSql 9.x on CentOS

Install and Configure pgBadger for PostgreSql 9.x on CentOS

Yes, one of the most important things is knowing how the databases are used. Indeed if we know what are the slowest queries, the most frequent queries, etc.; we can optimize the databases (by adding an index, changing a query or modifying a schema/structure) and thus improve the performance! To do this, you have to analyze PostgreSQL activity logs. Analyzing can be extremely complicated, so you have to use a log analyzer to process your data. pgBadger will help you to create reports, and monitor your database activity. So here is how you can Install and Configure pgBadger for PostgreSql 9.x on CentOS 7.

Command to generate report from a specific logfile

You can use a cron job to automatically generate pgbadger reports if logs have been created. Here is my /etc/cron.daily/pgbadger-daily_process:

This cron job will automatically create pgbadger reports according to yesterday’s PostgreSQL log.

That’s all! Thanks to pgBadger that tells you everything about your database activity 🙂

Share this post

Comments (2)

  • pete Reply

    Hi Sumeet,

    I have successfully installed PgBadger on my postgre server. How can I see the number of connections per day in the pgbadger console. Or is there anyway to find the no of connections per day?

    Thanks,
    Pete

    June 29, 2016 at 6:42 pm
  • Morv Reply

    Hi, on occasion I get a 500 website error when I browse this site. Just a heads up, cheers

    May 11, 2017 at 9:06 pm

Leave a comment

Your email address will not be published.