PostgreSQL的日志分析工具--pgbadger安装与使用
pgbadger是用perl写的分析PostgreSQL日志的工具。
如果需要分析PostgreSQL生成的csv日志,则必须保证本机中安装了perl的 Text::CSV_XS 模块。
安装步骤:
在下载最新的release版本
[root@testos ~]# tar -zvxf pgbadger-4.1.tar.gz
pgbadger-4.1/
pgbadger-4.1/.gitignore
pgbadger-4.1/.perltidyrc
pgbadger-4.1/CONTRIBUTING.md
pgbadger-4.1/ChangeLog
pgbadger-4.1/LICENSE
pgbadger-4.1/MANIFEST
pgbadger-4.1/META.yml
pgbadger-4.1/Makefile.PL
pgbadger-4.1/README
pgbadger-4.1/doc/
pgbadger-4.1/doc/pgBadger.pod
pgbadger-4.1/pgbadger
[root@testos pg]# cd pgbadger-4.1
[root@testos pgbadger-4.1]# perl Makefile.PL
WARNING: META_MERGE is not a known parameter.
Checking if your kit is complete...
Looks good
'META_MERGE' is not a known MakeMaker parameter name.
Writing Makefile for pgBadger
[root@testos pgbadger-4.1]# make
cp pgbadger blib/script/pgbadger
/usr/bin/perl "-MExtUtils::MY" -e "MY->fixin(shift)" blib/script/pgbadger
Manifying blib/man1/pgbadger.1
[root@testos pgbadger-4.1]# make install
Installing /usr/share/man/man1/pgbadger.1
Installing /usr/bin/pgbadger
Writing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/pgBadger/.packlist
Appending installation info to /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod
[root@testos pgbadger-4.1]# which pgbadger
/usr/bin/pgbadger
[root@testos ~]# pgbadger -V
pgBadger version 4.1
使用示例:
[root@testos ~]# pgbadger /pgdata/pg_log/postgresql-2013-11-26_000000.csv -o abc.html
[=======================> ] Parsed 3596337 bytes of 3711651 (96.89%), queries: 7928, events: 1457
LOG: Ok, generating html report...
Wide character in print at /usr/bin/pgbadger line 6345, line 1352.
Wide character in print at /usr/bin/pgbadger line 6408, line 1352.
Wide character in print at /usr/bin/pgbadger line 6408, line 1352.
Wide character in print at /usr/bin/pgbadger line 6345, line 1352.
Wide character in print at /usr/bin/pgbadger line 6408, line 1352.
Wide character in print at /usr/bin/pgbadger line 6345, line 1352.
Wide character in print at /usr/bin/pgbadger line 6408, line 1352.
[root@testos ~]#
说明:-o 指定输出文件
阅读(5147) | 评论(0) | 转发(1) |