ireuben / pgbadger

Small Perl script that aims to replace and outperform pgFouine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DESCRIPTION:
------------

PgBadger - An other PostgreSQL log analyzer that aims to replace and
           outperforms pgFouine

This is still a work in progress.

PREREQUISITE:
-------------

You must first enable SQL query logging to have something to parse:

	log_min_duration_statement = 0

With 'stderr' log format, log line prefix must be at least:

	log_line_prefix = '%t [%p]: [%l-1] '

Log line prefix could add user and database name as follow:

	log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d '

or for syslog log file format:

	log_line_prefix = 'user=%u,db=%d '

Log line prefix for stderr output could also be:

	log_line_prefix = '%t [%p]: [%l-1] db=%d,user=%u '

or for syslog output:

	log_line_prefix = 'db=%d,user=%u '

Additional informations that could be collected need logging activation into postgresql.conf:

	log_checkpoints = on
	log_connections = on
	log_disconnections = on
	log_lock_waits = on
	log_temp_files = 0


USAGE:
------

pgbadger -l logfile [...]

    -l | --logfile filename: path to the PostgreSQL log file to parse. It can
                             be a plain text log or a gzip compressed file
                             with the .gz extension.
    -f | --format logtype  : the value can be: syslog or stderr. Default: stderr
    -o | --outfile filename: define the filename for the output. Default depends
                             of the output format: out.html or out.txt. To dump
                             output to stdout use - as filename.
    -i | --ident name      : programname used as syslog ident. Default: postgres
    -h | --help            : show this message and exit.
    -d | --dbname database : only report what concern the given database
    -u | --dbuser username : only report what concern the given user
    -t | --top number      : number of query to store/display. Default: 20
    -s | --sample number   : number of query sample to store/display. Default: 3
    -x | --extension       : output format. Values: text or html. Default: html
    -m | --maxlength size  : maximum length of a query, it will be cutted above
                             the given size. Default: no truncate
    -g | --graph           : generate graphs, requires GD::Graph perl module
    -b | --begin datetime  : start date/time for the data to be parsed in log.
    -e | --end datetime    : end date/time for the data to be parsed in log.
    -q | --quiet           : disable output to stderr and don't print debug informations.
    -p | --progress        : show a progress bar, quiet mode is enabled with this option.
    --pie-limit num        : do not show pie data lower that num%, show a sum of them instead.

AUTHORS:
--------

Gilles Darold <gilles.darold@dalibo.com>

About

Small Perl script that aims to replace and outperform pgFouine

License:Other


Languages

Language:Perl 100.0%