ABOUT

pgBadger is a standalone Perl program that uses a javascript library (flotr2) to draw graphs so that you don't need to install any additional modules or other packages. Furthermore, this library gives us more features such as zooming. pgBadger also uses the Bootstrap javascript library and the FontAwesome webfont for better design. Everything is embedded.

pgBadger is able to autodetect your PostgreSQL log file format (syslog, stderr, csvlog or jsonlog) as well as pgbouncer log file. It is designed to parse huge log files as well as gzip compressed file. See a complete list of features below.

All charts are zoomable and can be saved as PNG images.

You can also limit pgBadger to only report errors or remove any part of the report using command line options.

pgBadger supports any custom format set into the log_line_prefix directive of your postgresql.conf file as long as it at least specify a time escape sequence (%t, %m or %n) and the process related escape sequence (%p or %c).

pgBadger allow parallel processing on a single log file and multiple files through the use of the -j or -J options and the number of CPUs as value.

If you want to save system performance you can also use log_duration instead of log_min_duration_statement to have reports on duration and number of queries only.

pgBadger supports an incremental mode that allow to construct incremental reports after successives runs of pgBadger. It is possible to run pgbadger each days or even more, each hours, and have cumulatives reports per day and per week. A top index page will allow you to go directly to the weekly and daily reports.

LATEST PGBADGER NEWS

Version 12.4 - 2023-12-25

This is a maintenance release of pgBadger that fixes issues reported by users since last release.

  - Fix pgbouncer report with version 1.21. Thanks to Ales Zeleny for the patch.
  - Prevent parallelism perl file to be higher than the number of files. Thanks
    to maliangzhu for the report.
  - Fix regression test broken since v12.3. Thanks to ieshin for the report.
  - Fix cases where LOG entries where counted as ERROR log level entries. Thanks
    to Matti Linnanvuori for the report.

Version 12.3 - 2023-11-27

This is a maintenance release of pgBadger that fixes issues reported by users since last release. It also adds two new features:

  * Add option `--include-pid` to only report events related to a session
    pid (%p). Can be used multiple time. Thanks to Henrietta Dombrovskaya
    for the feature request.
  * Add option `--include-session` to only report events related to the
    session id (%c). Can be used multiple time. Thanks to Henrietta Dombrovskaya
    for the feature request.
  * Add option `--dump-raw-csv` to only parse the log and dump the information
    into CSV format. No further processing is done, no report is generated.
    Thanks to Henrietta Dombrovskaya for the feature request.

Here is the complete list of changes and acknowledgments:

  - Update pgFormatter to version 5.5
  - Fix end date of parsing with jsonlog format. Thanks to jw1u1 for the report.
  - Fix typo in "Sessions per application". Thanks to fairyfar for the patch.
  - Fix "INSERT/UPDATE/DELETE Traffic" chart bug. Thanks to fairyfar for the
    patch.
  - Fix parsing of orphan lines with bind queries. Thanks to youxq for the
    report.
  - Fix Analyze per table report with new PG versions. Thanks to Jean-Christophe
    Arnu for the patch.
  - Fix syslog entry parser when the syslog timestamp contains milliseconds.
    Thanks to Pavel Rabel for the report.

Version 12.2 - 2023-08-20

This is a maintenance release of pgBadger that fixes issues reported by users since last release. It also adds two new features:

  * Add support for max, avg, min autovacuum duration. Thanks to Francisco Reinolds for the patch.
  * Add support for pgbouncer's average waiting time. Thanks to Francisco Reinolds for the patch.

Here is the complete list of changes and acknowledgments:

  - Fix broken HTML output when application name contains <...>. Thanks to Fabio Geiss for the report.
  - Fix incorrect association of orphan lines when a filter on database was applied. Thanks to jcasanov for the report.
  - Fix logplex prefix parsing.
  - Fix logplex orphan lines detection.
  - Fix autovacuum's system usage: CPU: ... line parsing. Thanks to Francisco Reinolds for the patch.
  - Avoid prepending output directory if output is stdout.
  - Standardize Average Query Duration label. Thanks to Francisco Reinolds for the patch
  - Update documentation for new pgbadger options. Thanks to Francisco Reinolds for the patch.
  - Fix case where parsing was not aborted when no file handle can be opened. Thanks to vp for the report.
  - Fix help by adding %p and %t as mandatory placeholders log information. Thanks to Christophe Courtois for the patch.
  - Fix --retention parameter. Thanks to Bertrand Bourgier for the patch.
  - Fix cleanup output directory removed by commit 0e5c7d5 when HTML output dir is set. Thanks to Bertrand Bourgier for the report.
  - Fix output extension when destination directory contain a character that need to be escaped in regexp. Thanks to Bertrand Bourgier for the patch.
  - Replace calls to POSIX::strftime("%s", ....) by a call to localtime for Windows port. Thanks to Bertrand Bourgier for the patch.
  - Fix html output dir cleanup. Thanks to Bertrand Bourgier for the patch.
  - Use https for explain URL by default. Thanks to Philipp Trulson for the patch.

Version 12.1 - 2023-03-20

This is a maintenance release of pgBadger that fixes issues reported by users since past six months.

Here is the complete list of changes and acknowledgments:

  - Fix parsing of multiline parameters. Thanks to Bekir Niyaz for the report.
  - Fix failure to normalize query with ::tsrange. Thanks to Philippe Griboval for the report.
  - Add logical decoding consistent point and start for slot log entries to the events report.
  - Handle other ns + timezone format in timestamp. Thanks to Ronan Dunklau for the report.
  - Fix detection of %m when notation with T is used. Thanks to Ronan Dunklau for the report.
  - Add parsing of CloudNativePG generated logs. Thanks to codrut panea for the patch.
  - Fix unused option --outdir in report generation. Thanks to Frederic Guiet for the report.
  - Update README with last documentation changes. Thanks to Manisankar for the report.
  - Fix a typo in pgbadger examples. Thanks to Shinichi Hashiba for the patch.

Version 12.0 - 2022-09-13

This major release of pgBadger fixes some issues reported by users since past five months. As usual there is also new features and improvements:

  * Remove support to Tsung output.
  * Improve pgbadger performances when there are hundred of bind parameters to replace.
  * Remove option -n | --nohighlight which is no more used since upgrade to pgFormatter 4.
  * Use POST method to send auto_explain plan to explain.depesz.com to avoid GET length parameter limit.
  * Apply --exclude-query and --include-query to bind/parse traces.
  * Add link to pgBadger report examples to documentation.

Here is the complete list of changes and acknowledgments:

  - Fix monthly reports that was failing on "log file ... must exists". Thanks to Jaume Sabater for the report.
  - Fix pgbouncer start parsing debug message when input is stdin. Thanks to Ales Zeleny for the report.
  - Remove support to Tsung output.
  - Drastically improve pgbadger performances for bind parameters replacement that could make
    pgbadger run infinitely when there was hundred of parameters. Thanks to Monty Mobile for the report.
  - Fix documentation about pgBadger return codes and also some wrong return code at some places.
    Thanks to Jaume Sabater for the report.
  - Fix several typo. Thanks to David Gilman for the patch.
  - Remove option -n | --nohighlight which is no more used since upgrade to pgFormatter 4.
    Thanks to Elena Indrupskaya for the report.
  - Lot of pgbadger documentation fixes. Thanks to Elena Indrupskay from Postgres Pro for the patch.
  - Allow half hour in --log-timezone and --timezone, value can be an integer, ex: 2 or a float, ex: 2.5.
    Thanks to Mujjamil-K for the feature request.
  - Allow use of regexp for --exclude-app and --exclude-client. Thanks to rdnkrkmz for the feature request.
  - Allow use of --explain-url with previous commit and restore the limitation to explain text format.
  - Use POST method to send auto_explain plan to explain.depesz.com to avoid GET length parameter limit.
    Thanks to hvisage for the report.
  - Apply --exclude-query and --include-query to bind/parse traces. Thanks to Alec Lazarescu for the report.
  - Fix parsing of autovacuum stats from RDS logs. Thanks to David Gilman for the report.
  - Fix passing of log format when parsing remote log. Thanks to spookypeanut the report.
  - Add link to pgBadger report examples to documentation.
  - Fix Session per user reports. Thanks to vitalca for the report.
  - Fix jsonlog parsing from PG15 ouput
  - Fix text-based error/events reporting. Thanks to Michael Banck for the patch
  - Fix regexp typo in normalize_error(). Thanks to Michael Banck for the patch.

Version 11.8 - 2022-04-08

This release of pgBadger fix some issues reported by users since past three months and especially two fixes on new log entries detection in incremental mode.

  * Fix detection of new log entries with timestamp when millisecond (%m) or
    epoch (%n) was used in log_line_prefix.
  * Fix detection of new log entries in local file when multiprocess was not
    used.

Here is the complete list of changes and acknowledgments:

  - Full review and simplification of the log file change detection.
  - Reports messages "could not (receive|send) data (from|to) client" in the
    Events reports. Thanks to Adrien Nayrat for the report.
  - Fix parsing issue when the name of a prepared query contain the ':'
    character. Thanks to aleszeleny for the report.
  - Fix detection of new log entries with timestamp when millisecond (%m) or
    epoch (%n). Thanks to aleszeleny for the report.
  - Fix detection of new log entries in local file when multiprocess was not
    used. Thanks to aleszeleny for the report.
  - Fix detection of new log entries in remote files through ssh. Thanks to
    Luca Ferrari for the report
  - Fix garbage in username of "Connections per user" report. Thanks to
    caseyandgina for the report.
  - Fix ssh command when using URI, the ssh options was missing. Thanks to Luca
    Ferrari for the report.
  - Handle queryid %Q placeholder. Thanks to Adrien Nayrat for the patch.
  - Fix typo in error sentence. Thanks to Luca Ferrari for the patch
  - Report message: "server process was terminated by signal" in the Events
    report. Thanks to Avi Vallarapu for the report.
  - doc: fix filename for incremental every week command. Thanks to Theophile
    Helleboid for the patch.
  - t/04_advanced.t: Fix syslog test. Thanks to Christoph Berg for the patch.

Version 11.7 - 2022-01-23

This release of pgBadger fix some issues reported by users since past five months as well as some improvements.

* Add new option --no-progressbar option to not display it but keep the
  other outputs.
* Add new option --day-report that can be used to rebuild an HTML report
  over the specified day. Like option --month-report but only for a day.
  It requires the incremental output directories and the presence of all
  necessary binary data files. The value is date in format: YYYY-MM-DD
* Improve parsing of Heroku logplex and cloudsql json logs.

Here is the complete list of changes and acknowledgments:

- Update contribution guidelines and Makefile.PL to improve consistency,
  clarity, and dependencies. Thanks to diffuse for the patch.
- Fix use of last parse file (--last-parsed) with binary mode. Thanks to
  wibrt for the report.
- Add regression test for --last-parsed use and fix regression test on
  report for temporary files only.
- Fix title for session per host graph. Thanks to Norbert Bede for the
  report.
- Fix week number when computing weeks reports when --iso-week-number
  and --incremental options was enabled. Thanks to hansgv for the report.
- Add --no-progressbar option to not display it and keep the other outputs.
  Thanks to seidlmic for the feature request.
- Prevent too much unknown format line prints in debug mode for multi-line
  jsonlog.
- Fix parsing of single line cloudsql json log. Thanks to Thomas Leclaire
  for the report.
- Fix temporary files summary with log_temp_files only.
- Print debug message with -v even if -q or --quiet is used.
- Fix autodetection of jsonlog file.
- Fix parsing of cloudsql log file. Thanks to Luc Lamarle for the report.
- Fixes pid extraction in parse_json_input. Thanks to Francois Scala for
  the patch.
- Add new option --day-report with value as date in format: YYYY-MM-DD
  that can be used to rebuild an HTML report over the specified day.
  Thanks to Thomas Leclaire for the feature request.
- Fix query counter in progress bar. Thanks to Guillaume Lelarge for the
  report.
- Fix incomplete queries stored for top bind and prepare reports.
- Fix normalization of object identifier, in some case the numbers was
  replaced by a ?.
- Fix unformatted normalized queries when there is a comment at beginning.
- Fix multi-line in stderr format when --dbname is used. Thanks to
  Guillaume Lelarge for the report.
- Fix not generated reports in incremental mode when --dbname is used.
  Thanks to Dudley Perkins for the report.
- Do not die anymore if a binary file is not compatible, switch to next
  file. Thanks to Thomas Leclaire for the suggestion.
- Fix Heroku logplex format change in pgbadger parser. Thanks to François
  Pietka for the report.

Version 11.6 - 2021-09-04

This release of pgBadger fix some issues reported by users since past seven months as well as some improvements.

  * Add detection of Query Id in log_line_prefix new in PG14. Thanks to
    Florent Jardin for the report.
  * Add advanced regression tests with db exclusion and the explode
    feature. Thanks to MigOps Inc for the patch.
  * Apply multiprocess to report generation when --explode is used.
    Thanks to MigOps Inc for the patch and Thomas Leclaire for the
    feature request.
  * Add --iso-week-number in incremental mode, calendar's weeks start
    on a Monday and respect the ISO 8601 week number, range 01 to 53,
    where week 1 is the first week that has at least 4 days in the new
    year. Thanks to Alex Muntada for the feature request.
  * Add command line option --keep-comments to not remove comments from
    normalized queries. It can be useful if you want to distinguish
    between same normalized queries. Thanks to Stefan Corneliu Petrea
    for the feature request.
  * Skip INFO lines introduced in PostgreSQL log file by third parties
    software. Thanks to David Piscitelli for the report.
  * Add compatibility with PostgresPro log file including rows number
    and size in bytes following the statement duration. Thanks to
    panatamann for the report.
  * Parse times with T's to allow using the timestamps from journalctl.
    Thanks to Graham Christensen for the patch.
  * Improve Windows port. Thanks to Bertrand Bourgier for the patches.

Important note:

  * Expect that --iso-week-number will be the default in next major
    release and that --start-monday option will be removed as the week
    will always start a Monday. The possibility to have week reports
    start a Sunday will be removed to simplify the code.

For the complete list of changes, please checkout the release note


Version 11.5 - 2021-02-18

This release of pgBadger fix some issues reported by users since past three months as well as some improvements:

  * Add report about sessions idle time, computed using:
    "total sessions time - total queries time / number of sessions
    This require that log_connection and log disconnection have been
    enabled and that log_min_duration_statement = 0 (all queries logged)
    to have a reliable value. This can help to know how much idle time
    is lost, and if a pooler transaction mode would be useful.
    This report is available in the "Sessions" tab of "Global Stats"
    and in the "Sessions" tab of "General Activity" reports (per hour).
  * Add anonymization of numeric values, replaced by 4 random digits.
  * Update SQL beautifier based on pgFormatter 5.0.

Here is the complete list of changes and acknowledgments:

  - Fix parsing of cloudsql multi-line statement. Thanks to Jon Young for the report.
  - Add regression test for anonymization.
  - Fix anonymization broken by maxlength truncate. Thanks to artl for the report.
  - Add anonymization of parameter in time consuming prepare and bind reports.
    Thanks to arlt for the report.
  - Add support to microseconds in logplex log line prefix. Thanks to Ross Gardiner for the report.
  - Add report about sessions idle time. Thanks to Guillaume Lelarge for the feature request.
  - Complete patch to support multi-line in jsonlog format.

Version 11.4 - 2020-11-24

This release of pgBadger fix some issues reported by users since past four months. Improve support for PostgreSQL 13 log information and adds some new features

  * Add full autovacuum information in "Vacuums per table" report for
    buffer usage (hits, missed, dirtied), skipped due to pins, skipped
    frozen and WAL usage (records, full page images, bytes). In report
    "Tuples removed per table" additional autovacuum information are
    tuples remaining, tuples not yet removable and pages remaining.
    These information are only available on the "Table" tab.
  * Add new repartition report about checkpoint starting causes.
  * Add detection of application name from connection authorized traces.

Here is the complete list of changes and acknowledgments:

  - Fix typo in an error message. Thanks to Vidar Tyldum for the patch.
  - Fix Windows port with error: "can not load incompatible binary data".
    Thanks to Eric Brawner for the report.
  - Fix typo on option --html-outdir in pgbadger usage and documentation.
    Thanks to Vidar Tyldum for the patch.
  - Fix autodetection of jsonlog/cloudsql format. Thanks to Jon Young
    for the report.
  - Fix CSV log parsing with PG v13. Thanks to Kanwei Li for the report
    and Kaarel Moppel for the patch.
  - Fix sort of queries generating the most temporary files report.
    Thanks to Sebastien Lardiere for the report.
  - Add pgbadger version trace in debug mode.

Version 11.3 - 2020-07-26

This release of pgBadger fix several issues reported by users since past four months. It also adds some new features and new command line options:

  * Add autodetection of UTC timestamp to avoid applying timezone
    for graphs.
  * Add support to GCP CloudSQL json log format.
  * Add new option --dump-all-queries to use pgBadger to dump all
    queries to a text file, no report is generated just the full list
    of statements found in the PostgreSQL log. Bind parameters are
    inserted into the queries at their respective position.
  * Add new option -Q | --query-numbering used to add numbering of
    queries to the output when using options --dump-all-queries or
    --normalized-only.
  * Add new command line option --tempdir to set the directory where
    temporary files will be written. Can be useful on system that do
    not allow writing to /tmp.
  * Add command line option --ssh-port used to set the ssh port if not
    default to 22. The URI notation also adds support to ssh port
    specification by using the form:
        ssh://192.168.1.100:2222//var/log/postgresql-11.log

Version 11.2 - 2020-03-17

This release of pgBadger fix several issues reported by users since past six months. It also adds some new features:

  * Add support and autodetection of AWS redshift log format.
  * Add support to pgbouncer 1.11 new log format.
  * Handle zstd and lz4 compression format
  * Allow to fully separate statistics build and HTML report build in
    incremental mode without having to read a log file. For example
    it is possible to run pgbadger each hours as follow:
    
        pgbadger -I -O "/out-dir/data" --noreport /var/log/postgresql*.log
    
    It just creates the data binary files in "/out-dir/data" then
   for example you can make reports each night for the next day in
   a separate directory `/out-dir/reports`:
    
        pgbadger -I -l "/out-dir/data/LAST_PARSED" -H "/out-dir/reports" /out-dir/data/2020/02/19/*.bin
    
    This require to set the path to the last parsed information, the
    path where HTML reports will be written and the binary data file
    of the day.

There is also new command line options:

  * Add new command line option --explain-url used to override the url
    of the graphical explain tool. Default URL is:
    
        http://explain.depesz.com/?is_public=0&is_anon=0&plan=
    
    If you want to use a local install of PgExplain or an other tool.
    pgBadger will add the plan in text format escaped at the end of
    the URL.

  * Add new option --no-week to instruct pgbadger to not build weekly
    reports in incremental mode. Useful if it takes too much time and
    resources.

  * Add new command line option --command to be able to set a command
    that pgBadger will execute to retrieve log entries on stdin.
    pgBadger will open a pipe to the command and parse log entries
    generated by the command. For example:
    
      pgbadger -f stderr --command 'cat /var/log/postgresql.log'
    
    which is the same as executing pgbadger with the log file directly
    as argument. The interest of this option is obvious if you have to
    modify the log file on the fly or that log entries are extracted
    from a program or generated from a database. For example:
    
      pgbadger -f csv --command 'psql dbname -c "COPY jrn_log TO STDOUT (FORMAT CSV)"'
    
  * Add new command line option --noexplain to prevent pgBadger to
    parse and report explain plan written to log by auto_explain
    extension. This is useful if you have a PostgreSQL version < 9.0
    where pgBadger generate broken reports when there is explain plan
    in log.

Backward compatibility:

  - By default pgBadger will truncate queries up to 100000 characters.
    This arbitrary value and can be adjusted using option --maxlength.
    Previous behavior was to not truncate queries but this could
    lead in excessive resources usage. Limiting default size is safer
    and the size limit might allow no truncate in most cases. However
    queries will not be beautified if they exceed 25000 characters.

For the complete list of changes, please checkout the release note on https://github.com/darold/pgbadger/blob/master/ChangeLog


Version 11.1 - 2019-09-16

This release of pgBadger fix several issues reported by users since three months. It also adds some new features and reports:

  - Add report of top N queries that consume the most time in the
    prepare or parse stage.
  - Add report of top N queries that consume the most time in the
    bind stage.
  - Add report of timing for prepare/bind/execute queries parts.
    Reported in a new "Duration" tab in Global Stats report. Example:
        Total query duration: 6m16s
        Prepare/parse total duration: 45s564ms
        Bind total duration: 4m46s
        Execute total duration: 44s71m
    This also fix previous report of "Total query duration" that was
    only reporting execute total duration.
  - Add support to RDS and CloudWatch log format, they are detected
    automatically. You can use -f rds if pgbadger is not able to
    auto-detect the log format.
  - Add new configuration option --month-report to be able to build
    monthly incremental reports.
  - Restore support to Windows operating system.

For the complete list of changes, please checkout the release note on https://github.com/darold/pgbadger/blob/master/ChangeLog


Version 11.3 - 2020-07-26

pgBadger 11.3 was released today, this is a maintenance release that fixes issues reported by users during last four months. There is also some new useful features:

  * Add autodetection of UTC timestamp to avoid applying timezone
    for graphs.
  * Add support to GCP CloudSQL json log format.
  * Add new option --dump-all-queries to use pgBadger to dump all
    queries to a text file, no report is generated just the full list
    of statements found in the PostgreSQL log. Bind parameters are
    inserted into the queries at their respective position.
  * Add new option -Q | --query-numbering used to add numbering of
    queries to the output when using options --dump-all-queries or
    --normalized-only.
  * Add new command line option --tempdir to set the directory where
    temporary files will be written. Can be useful on system that do
    not allow writing to /tmp.
  * Add command line option --ssh-port used to set the ssh port if not
    default to 22. The URI notation also adds support to ssh port
    specification by using the form:
        ssh://192.168.1.100:2222//var/log/postgresql-11.log

For the complete list of changes, please checkout the release note on https://github.com/darold/pgbadger/blob/master/ChangeLog


Version 11.2 - 2020-03-11

This release of pgBadger fix several issues reported by users since past six months. It also adds some new features:

  * Add support and autodetection of AWS redshift log format.
  * Add support to pgbouncer 1.11 new log format.
  * Handle zstd and lz4 compression format
  * Allow to fully separate statistics build and HTML report build in
    incremental mode without having to read a log file. For example
    it is possible to run pgbadger each hours as follow:
    
        pgbadger -I -O "/out-dir/data" --noreport /var/log/postgresql*.log
    
    It just creates the data binary files in "/out-dir/data" then
   for example you can make reports each night for the next day in
   a separate directory `/out-dir/reports`:
    
        pgbadger -I -l "/out-dir/data/LAST_PARSED" -H "/out-dir/reports" /out-dir/data/2020/02/19/*.bin
    
    This require to set the path to the last parsed information, the
    path where HTML reports will be written and the binary data file
    of the day.

There is also new command line options:

  * Add new command line option --explain-url used to override the url
    of the graphical explain tool. Default URL is:
    
        http://explain.depesz.com/?is_public=0&is_anon=0&plan=
    
    If you want to use a local install of PgExplain or an other tool.
    pgBadger will add the plan in text format escaped at the end of
    the URL.

  * Add new option --no-week to instruct pgbadger to not build weekly
    reports in incremental mode. Useful if it takes too much time and
    resources.

  * Add new command line option --command to be able to set a command
    that pgBadger will execute to retrieve log entries on stdin.
    pgBadger will open a pipe to the command and parse log entries
    generated by the command. For example:
    
      pgbadger -f stderr --command 'cat /var/log/postgresql.log'
    
    which is the same as executing pgbadger with the log file directly
    as argument. The interest of this option is obvious if you have to
    modify the log file on the fly or that log entries are extracted
    from a program or generated from a database. For example:
    
      pgbadger -f csv --command 'psql dbname -c "COPY jrn_log TO STDOUT (FORMAT CSV)"'
    
  * Add new command line option --noexplain to prevent pgBadger to
    parse and report explain plan written to log by auto_explain
    extension. This is useful if you have a PostgreSQL version < 9.0
    where pgBadger generate broken reports when there is explain plan
    in log.

Backward compatibility:

  - By default pgBadger will truncate queries up to 100000 characters.
    This arbitrary value and can be adjusted using option --maxlength.
    Previous behavior was to not truncate queries but this could
    lead in excessive resources usage. Limiting default size is safer
    and the size limit might allow no truncate in most cases. However
    queries will not be beautified if they exceed 25000 characters.

Version 11.1 - 2019-09-26

This release of pgBadger fix several issues reported by users since three months. It also adds some new features and reports:

  - Add report of top N queries that consume the most time in the
    prepare or parse stage.
  - Add report of top N queries that consume the most time in the
    bind stage.
  - Add report of timing for prepare/bind/execute queries parts.
    Reported in a new "Duration" tab in Global Stats report. Example:
        Total query duration: 6m16s
        Prepare/parse total duration: 45s564ms
        Bind total duration: 4m46s
        Execute total duration: 44s71m
    This also fix previous report of "Total query duration" that was
    only reporting execute total duration.
  - Add support to RDS and CloudWatch log format, they are detected
    automatically. You can use -f rds if pgbadger is not able to
    auto-detect the log format.
  - Add new configuration option --month-report to be able to build
    monthly incremental reports.
  - Restore support to Windows operating system.

Version 11.0 - 2019-06-25

This release of pgBadger adds some major new features and fixes some issues reported by users since the last four months. New features:

  - Regroup cursor related query (DECLARE,CLOSE,FETCH,MOVE) into new
    query type CURSOR.
  - Add top bind queries that generate the more temporary files.
    Require log_connection and log_disconnection be activated.
  - Add --exclude-client command line option to be able to exclude log
    entries for the specified client ip. Can be used multiple time.
  - Allow to use time only in --begin and --end filters.
  - Add -H, --html-dir option to be able to set a different path where
    HTML report must be written in incremental mode. Binary files stay
    on directory defined with -O, --outdir option.
  - Add -E | --explode option to explode the main report into one
    report per database. Global information not related to a database
    are added to the postgres database report.
  - Add per database report to incremental mode. In this mode there
    will be a sub directory per database with dedicated incremental
    reports.
  - Add support to Heroku's PostgreSQL logplex format. Log can be
    parsed using:

      heroku logs -p postgres | pgbadger -f logplex -o heroku.html -

  - When a query is > 10Kb we first limit size of all constant string
    parameters to 30 characters and then the query is truncated to 10Kb.
    This prevent pgbadger to waste time/hang with very long queries
    when inserting bytea for example. The 10Kb limit can be controlled
    with the --maxlength command line parameter.
    The query is normalized or truncated to maxlength value only after
    this first attempt to limit size.

This new release breaks backward compatibility with old binary or JSON files. This also mean that incremental mode will not be able to read old binary file. If you want to update pgBadger and keep you old reports take care to upgrade at start of a new week otherwise weekly report will be broken. pgBadger will print a warning and just skip the old binary file.

For the complete list of changes, please checkout the release note on https://github.com/darold/pgbadger/blob/master/ChangeLog


Version 10.3 - 2019-02-14

This release of pgBadger is a maintenance release that fixes some log format autodetection issues another pgBouncer log parsing issue reported by users. There is also a new feature:

    The -o | --outfile option can now be used multiple time to dump
    output in several format in a single command. For example:
        pgbadger -o out.html -o out.json /log/pgsql-11.log
    will create two reports in html and json format saved in the
    two corresponding files.

For the complete list of changes, please checkout the release note on https://github.com/darold/pgbadger/blob/master/ChangeLog


Version 10.2 - 2018-12-27

This release of pgBadger is a maintenance release that fixes issues reported by users during last three months. There is also some new features:

  * Add support to pgbouncer 1.8 Stats log format.
  * Auto adjust javascript graph timezone.
  * Add support to http or ftp remote PostgreSQL log file download.
    The log file is parsed during the download using curl command
    and never saved to disk. With ssh remote log parsing you can use
    uri as command line argument to specify the PostgreSQL log file.
    
            ssh://localhost/postgresql-10-main.log
            http://localhost/postgresql-10-main.log.gz
            ftp://localhost/postgresql-10-main.log
    
    with http and ftp protocol you need to specify the log file format
    at end of the uri:
    
            http://localhost/postgresql-10-main.log:stderr
    
    You can specify multiple uri for log files to be parsed. This is
    useful when you have pgbouncer log file on a remote host and
    PostgreSQL logs in the local host.

    With ssh protocol you can use wild card too like with remote
    mode, ex: ssh://localhost/postgresql-10-main.log*
    
    Old syntax to parse remote log file using -r option is still
    working but is obsolete and might be removed in future versions.

There is a new command line option:

  * Add --exclude-db option to compute report about everything except
    the specified database.

Version 10.1 - 2018-09-12

This release of pgBadger is a maintenance release that fixes reports in incremental mode and multiprocess with -j option. Log parsing from standard input was also broken. If you are using v10.0 please upgrade now.

  - Add test on pgbouncer log parser.
  - Some little performances improvment.
  - Fix not a valid file descriptor at pgbadger line 12314.
  - Fix unwanted newline in progressbar at startup.
  - Remove circleci files from the project.
  - Remove dependency of bats and jq for the test suite, they are
    replaced with Test::Simple and JSON::XS.
  - Add more tests especially for incremental mode and input from
    stdin that was broken in release 10.0.
  - Sync pgbadger, pod, and README, and fix some syntax errors.
    Thanks to Christoph Berg for the patch.
  - Add documentation on how to install Perl module JSON::XS from
    apt and yum repositories.
  - Fix URI for CSS in incremental mode. Thanks to Floris van Nee
    for the report.
  - Fix fatal error when looking for log from STDIN. Thanks to
    Jacek Szpot for the report.
  - Fixes SED use for OSX builds. Thanks to Steve Newson for the
    patch.
  - Fix illegal division by zero in incrental mode. Thanks to
    aleszeleny for the report.
  - Replace SQL::Beautify with v3.1 of pgFormatter::Beautify.

Thanks a lot to Etienne Bersac from Dalibo who have initiate the pgbadger test suite and added information about contributing in the documentation. Unitary tests are still not complete but tests of features fixed in this maintenance release have been added.


Version 10.0 - 2018-09-09

pgBadger 10.0 was released today, this release of pgBadger is a major release that adds some new features and fix all issues reported by users since last release. Every one should upgrade.

  * Add support of pgbouncer syslog log file format.
  * Add support to all auto_explain format (text, xml, json and yaml).
  * Add support to %q placeholder in log_line_prefix.
  * Add jsonlog format of Michael Paquier extension, with -f jsonlog
    pgbadger will be able to parse the log.
  * Replace the SQL formatter/beautify with v3.0 of pgFormatter.

There is some new command line options:

  - Add --prettify-json command line option to prettify JSON output.
  - Add --log-timezone  +/-XX  command line option to set the number
    of hours from GMT of the timezone that must be used to adjust
    date/time read from log file before beeing parsed. Note that you
    might still need to adjust the graph timezone using -Z when the
    client has not the same timezone.
  - Add --include-time option to add the ability to choose times that
    you want to see, instead of excluding all the times you do not
    want to see (--exclude-time).

The pgBadger project and copyrights has been transferred from Dalibo to the author and official maintainer of the project. Please update your links:

  - Web site: http://pgbadger.darold.net/
  - Source code: https://github.com/darold/pgbadger

I want to thanks the great guys at Dalibo for all their investments into pgBadger during these years and especially Damien Clochard and Jean-paul argudo for their help to promote pgBadger.

For the complete list of changes, please checkout the release note on https://github.com/darold/pgbadger/blob/master/ChangeLog


pgBadger is back to home - 2018-08-28

After one year I'm please to announce that the badger is back to home. A new version is coming soon fixing all pending issues and more as usual. I built a new website tonight for the occasion.
Welcome back pgBadger!


Version 9.2 - 2017-07-27

This release of pgBadger is a maintenance release that also adds some new features.

  * Add report of checkpoint distance and estimate.
  * Add support of AWS Redshift keywords to SQL code beautifier.
  * Add autodetection of log format in remote mode to allow remote
    parsing of pgbouncer log file together with PostgreSQL log file.

There's also some bugs fixes and features enhancements.

  - Fix reports with histogram that was not showing data upper than
    the last range.
  - Fix parsing of journalctl without the the log line number pattern
    ([%l-n]). Thanks to Christian Schmitt for the report.
  - Add report of checkpoint distance and estimate. Thanks to jjsantam
    for the feature request.
  - Append more information on what is done by script to update CSS
    and javascript files, tools/updt_embedded_rsc.pl.
  - Do not warn when all log files are empty and exit with code 0.
  - Fix build_log_line_prefix_regex() that does not include %n as a
    lookup in %regex_map. Thanks to ghosthound for the patch.
  - Change error level of "FATAL: cannot use CSV" to WARNING. Thanks
    to kong1man for the report.
  - Fix use of uninitialized value warning. Thanks to Payal for the
    report.
  - Add permission denied to error normalization
  - Update pgbadger to latest commit 5bdc018 of pgFormatter.
  - Add support for AWS Redshift keywords. Thanks to cavanaug for the
    feature request.
  - Fix missing query in temporary file report when the query was
    canceled. Thanks to Fabrizio de Royes Mello for the report.
  - Normalize query with binded parameters, replaced with a ?.
  - Sanity check to avoid end time before start time. Thanks to
    Christophe Courtois for the patch.
  - Fix a lot of mystyped words and do some grammatical fixes. Use
    'pgBadger' where it refers to the program and not the binary file.
    Also, use "official" expressions such as PgBouncer, GitHub, and
    CSS. POD file was synced with README. Thanks to Euler Taveira for
    the patch.
  - Menu is broken when --disable-type top_cancelled_info test and
    closing list must be inside disable_type test. While in it, ident
    disable_lock test. Thanks to Euler Taveira for the patch.
  - Fix use of uninitialized value. Thanks to johnkrugger for the
    report.
  - Remove test to read log file during log format auto-detection when
    the file is hosted remotly. Thanks to clomdd for the report.
  - Add autodetection of log format in remote mode to allow remote
    parsing of pgbouncer log file together with PostgreSQL log file.
  - Fix number of sessions wrongly increased after log line validation
    Thanks to Achilleas Mantzios for the report.
  - Minor reformatting of the pgBadger Description.
  - Fix repeated info in documentation. Thanks to cscatolini for the patch.

Version 9.1 - 2017-01-24

This release of pgBadger is a maintenance release that adds some new features.

  * Add report of error class distribution when SQLState is available
    in the log_line_prefix (see %e placeholder).
  * Update SQL Beautifier to pgFormatter v1.6 code.
  * Improve error message normalization.
  * Add --normalized-only option to generate a text file containing all
    normalized queries found in a log with count.
  * Allow %c (session id) to replace %p (pid) as unique session id.
  * Add waiting for lock messages to event reports.
  * Add --start-monday option to start calendar weeks in Monday
    instead of default to Sunday.

There's also some bugs fixes and features enhancements.

  - Add report of error class distribution when SQLState is available
    in the log line prefix. Thanks to jacks33 for the feature request.
  - Fix incremental global index on resize. Thanks to clomdd for the
    report.
  - Fix command tag log_line_prefix placeholder %i to allow space
    character.
  - Fix --exclude-line options and removing of obsolete directory
    when retention is enabled and --noreport is used.
  - Fix typo in "vacuum activity table". Thanks to Nicolas Gollet for
    the patch.
  - Fix autovacuum report. Thanks to Nicolas Gollet for the patch.
  - Fix author of pgbadger's logo - Damien Cazeils and English in
    comments. Thanks to Thibaut Madelaine for the patch.
  - Add information about pgbouncer log format in the -f option.
    Thanks to clomdd for the report.
  - Add --normalized-only information in documentation.
  - Fix broken report of date-time introduced in previous patch.
  - Fix duration/query association when log_duration=on and
    log_statement=all. Thanks to Eric Jensen for the report.
  - Fix normalization of messages about advisory lock. Thanks to
    Thibaut Madelaine for the report.
  - Fix report of auto_explain output. Thanks to fch77700 for the
    report.
  - Fix unwanted log format auto detection with log entry from stdin.
    Thanks to Jesus Adolfo Parra for the report.
  - Add left open parentheses to the "stop" chars of regex to look
    for db client in the prefix to handle the PostgreSQL client
    string format that includes source port. Thanks to Jon Nelson
    for the patch.
  - Fix some spelling errors. Thanks to Jon Nelson for the patch.
  - Allow %c (session id) to replace %p (pid) as unique session id.
    Thanks to Jerryliuk for the report.
  - Allow pgbadger to parse default log_line_prefix that will be
    probably used in 10.0: '%m [%p] '
  - Fix missing first line with interpreter call.
  - Fix missing Avg values in CSV report. Thanks to Yosuke Tomita
    for the report.
  - Fix error message in autodetect_format() method.
  - Add --start-monday option to start calendar weeks in Monday
    instead of default to Sunday. Thanks to Joosep Mae for the feature
    request.
  - Fix --histo-average option. Thanks to Yves Martin for the report.
  - Remove plural form of --ssh-option in documentation. Thanks to
    mark-a-s for the report.
  - Fix --exclude-time filter and rewrite code to skip unwanted line
    as well code to update the progress bar. Thanks to Michael
    Chesterton for the report.
  - Fix support to %r placeholder in prefix instead of %h.

Version 9.0 - 2016-09-02

This major release of pgBadger is a port to bootstrap 3 and a version upgrade of all resources files (CSS and Javascript). There's also some bugs fixes and features enhancements.

Backward compatibility with old incremental report might be preserved.

  - Sources and licences of resources files are now on a dedicated
    subdirectory. A script to update their minified version embedded
    in pgbager script has been added. Thanks to Christoph Berg for
    the help and feature request.

  - Try to detect user/database/host from connection strings if
    log_connection is enabled and log_line_prefix doesn't include
    them.
    
    Extend the regex to autodetect database name, user name, client
    ip address and application name. The regex now are the following:
    
    	db => qr/(?:db|database)=([^,]*)/;
    	user => qr/(?:user|usr)=([^,]*)/;
    	client => qr/(?:client|remote|ip|host)=([^,]*)/;
    	appname => qr/(?:app|application)=([^,]*)/;
    
  - Add backward compatibility with older version of pgbadger in
    incremental mode by creating a subdirectory for new CSS and
    Javascript files. This subdirectory is named with the major
    version number of pgbadger.
    
  - Increase the size of the pgbadger logo that appears too small
    with the new font size.

  - Normalize detailed information in all reports.

  - Fix duplicate copy icon in locks report.

  - Fix missing chart on histogram of session time. Thanks to
    Guillaume Lelarge for the report.

  - Add LICENSE file noting the licenses used by the resource
    files. Thanks to Christoph Berg for the patch.

  - Add patch to jqplot library to fix an infinite loop when trying
    to download some charts. Thanks to Julien Tachoires for the help
    to solve this issue.
    
  - Script tools/updt_embedded_rsc.pl will apply the patch to resource
    file resources/jquery.jqplot.js and doesn't complain if it has
    already been applied.

  - Remove single last comma at end of pie chart dataset. Thanks to
    Julien Tachoires for the report.

  - Change display of normalized error

  - Remove unused or auto-generated files

  - Update all resources files (js+css) and create a directory to
    include source of javascript libraries used in pgbadger. There is
    also a new script tools/updt_embedded_rsc.pl the can be used to
    generate the minified version of those files and embedded them
    into pgbadger.  This script will also embedded the FontAwesome.otf
    open truetype font into the fontawesome.css file.

DOWNLOAD

Official releases

Official release are published to the GitHub Release page of pgBadger.

Not all release are subject to a notification sent to the pgsql-announce mailling list, this is reserved to the main releases.

Binary packages

pgBadger may have a binary package corresponding to your distribution. For RPM packages, thanks to the great work of Devrim GÜNDÜZ, you can find the pgBadger package at the PostgreSQL yum repository

Thanks to Christoph BERG packages for Debian and Ubuntu are available in the PostgreSQL apt repository

Development code

The latest development code can always be found into the pgBadger's GitHub repository

LICENSE

Pricing

pgBadger is Free Software and is made fully available free of charge, you can use it as you want without having to pay anything.

Please just pay attention to support the author of pgBadger with your donation, which is purely optional.

License

PostgreSQL is released under the PostgreSQL License, a liberal Open Source license, similar to the BSD or MIT licenses.

Copyright © 2012-2020 Gilles Darold.

A modified version of the SQL::Beautify Perl Module is embedded in pgBadger with copyright (C) 2009 by Jonas Kramer published under the terms of the Artistic License 2.0.

Development effort

Source Lines of Perl Code: 19,678

Total Estimated Cost to Develop: $ 617,052

(Generated using David A. Wheeler's 'SLOCCount'.)

SUPPORT

Feature request & Bugs

Please report any bugs, patches, discussion, etc. using the GitHub tools at https://github.com/darold/pgbadger/.

If you need new features or you think something is missing, please send your comments and requests. This helps a lot to develop a better/useful tool.

How to contribute

Any contribution to build a better tool is welcome, you just have to send your ideas, features request or patches using the GitHub tools at https://github.com/darold/pgbadger/.

Commercial support

For a complete list of commercial support near of your place take a look at the PostgreSQL Professional Services page, they all do great job and most of them can help you.

SAMPLE REPORTS

sample reports

The sample report generated by pgBadger can be found here with pgbouncer statistics.

Incremental report generated by pgBadger can be found here.

Report of errors/events only can be found here.