Arguments:
- logfile can be a single log file, a list of files or a shell command
+ logfile can be a single log file, a list of files, or a shell command
returning a list of file.
Options:
-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. Note that this option is
- DEPRECATED, set logfile as a command line argument
+ DEPRECATED: set logfile as a command line argument
instead.
-f | --format logtype : possible values: syslog,stderr,csv. Default: stderr
-o | --outfile filename: define the filename for the output. Default depends
- of the output format: out.html or out.txt. To dump
+ on 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
+ -d | --dbname database : only report what concerns the given database
+ -u | --dbuser username : only report what concerns the given user
+ -t | --top number : number of queries to store/display. Default: 20
+ -s | --sample number : number of query samples 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
+ -m | --maxlength size : maximum length of a query: it will be cut above
the given size. Default: no truncate
-g | --graph : generate graphs using the Flotr2 javascript library
-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 : don't print anything to stdout.
- -p | --progress : show a progress bar, quiet mode is automaticaly
+ -p | --progress : show a progress bar, quiet mode is automatically
enabled with this option.
--pie-limit num : pie data lower than num% will show a sum instead.
-w | -watch-mode : only report errors just like logwatch could do.
--exclude-query regex : any query matching the given regex will be excluded
- from the report. For example: "^(VACUUM|COMMIT)"
- you can use this option multiple time.
+ from the report- for example: "^(VACUUM|COMMIT)".
+ You can use this option multiple times.
--disable-error : do not generate error report.
--disable-hourly : do not generate hourly reports.
--disable-type : do not generate query type report.
pgbadger -p -g /var/log/postgres.log.2.gz /var/log/postgres.log.1.gz /var/log/postgres.log
pgbadger -p -g /var/log/postgresql/postgresql-2012-05-*
pgbadger -p -g --exclude-query="^(COPY|COMMIT)" /var/log/postgresql.log
+ pgbadger -p -g -b "2012-06-25 10:56:11" -e "2012-06-25 10:59:11" /var/log/postgresql.log
Reporting errors every week by cron job:
30 23 * * 1 /usr/bin/pgbadger -q -w /var/log/postgresql.log -o /var/reports/pg_errors.html
- this suppose that your log file and HTML report are also rotated every
- weeks.
+ This suppose that your log file and HTML report are also rotated every
+ week.
DESCRIPTION
- pgBadger is a PostgreSQL log analyzer build for speed with fully
+ pgBadger is a PostgreSQL log analyzer built for speed with fully
detailed reports from your PostgreSQL log file. It's a single and small
Perl script that aims to replace and outperform the old php script
pgFouine.
By the way, we would like to thank Guillaume Smet for all the work he
has done on this really nice tool. We've been using it a long time, it
- was a really great tool!
+ is a really great tool!
pgBadger is written in pure Perl language. It uses a javascript library
to draw graphs so that you don't need additional Perl modules or any
- other package to install. Furthermore, this library gives us more
- features such as zooming.
+ other package to install. Furthermore, this library gives us additional
+ features, such as zooming.
pgBadger is able to autodetect your log file format (syslog, stderr or
- csvlog). It is designed to parse huge log files as well as gzip
- compressed file. See a complete list of features below.
+ csvlog). It is designed to parse huge log files, as well as gzip
+ compressed files. See a complete list of features below.
FEATURE
pgBadger reports everything about your SQL queries:
All charts are zoomable and can be saved as PNG images.
-REQUIREMENT
- PgBadger comes as a single Perl script, you do not need anything else
+REQUIREMENTS
+ PgBadger comes as a single Perl script- you do not need anything else
than a modern Perl distribution. Charts are rendered using a Javascript
- library so you don't need anything, your browser will do all the work.
+ library so you don't need anything. Your browser will do all the work.
If you planned to parse PostgreSQL CSV log files you might need some
Perl Modules:
format you don't need to install it.
POSTGRESQL CONFIGURATION
- You must enable some configuration directives into your postgresql.conf
+ You must enable some configuration directives in your postgresql.conf
before starting.
You must first enable SQL query logging to have something to parse:
be parsed by pgBadger.
INSTALLATION
- Download the tarball from github and unpack the archive as follow:
+ Download the tarball from github and unpack the archive as follows:
tar xzf pgbadger-1.x.tar.gz
cd pgbadger-1.x/
perl Makefile.PL
- make && make install
+ make && sudo make install
This will copy the Perl script pgbadger in /usr/local/bin/pgbadger
directory by default and the man page into
as argument of Makefile.PL. The script will be installed into
/usr/bin/pgbadger and the manpage into /usr/share/man/man1/pgbadger.1.
- For example to install everything just like Debian does, proceed as
+ For example, to install everything just like Debian does, proceed as
follow:
perl Makefile.PL INSTALLDIRS=vendor