pgBadger

A fast and detailed PostgreSQL log analyzer.

Database Utils Observability Containers Kubernetes On-premise
License: PostgreSQL License

Available Platforms

Details

pgBadger is a PostgreSQL log analyzer built for speed with fully detailed reports from your PostgreSQL log file. It is a small script written in Perl that outperforms any other log analyzer.

It is written in pure Perl and does not use any additional Perl modules. So, it can be used on any architecture where Perl is installed. It is very fast and can process huge log files.

Features

pgBadger is designed to handle large log files efficiently and provides a wealth of information about your PostgreSQL instance’s performance.

Key Capabilities

  • Performance: Built for speed, outperforming other log analyzers.
  • Parallel Processing: Supports multi-core processing for single large files or concurrent parsing of multiple files.
  • Incremental Reports: Automatically generates daily, weekly, and monthly cumulative reports.
  • Remote Parsing: Can parse log files from remote servers via SSH or directly from HTTP/FTP URIs.

Supported Log Formats

pgBadger auto-detects many log formats, including:

  • syslog, syslog2, stderr
  • jsonlog, csv
  • pgbouncer, logplex, rds, redshift

It also natively handles compressed files (gzip, bzip2, lz4, xz, zip, zstd).

Reports and Graphs

The tool generates comprehensive reports with zoomable graphs, covering:

  • SQL Statistics: Most frequent, slowest, and most time-consuming queries.
  • Time-based Analysis: Hourly charts for queries, temporary files, checkpoints, and errors.
  • Distribution: Pie charts for lock statistics, query types (SELECT/INSERT/etc.), and session distribution.
  • Errors: Detailed breakdown of error classes and frequent error events.

Output Options

While the default output is a self-contained HTML file with embedded graphs, pgBadger also supports:

  • Text: Plain text reports.
  • JSON: Structured data output.
  • Binary: For incremental report storage.