Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7092909
  • 博文数量: 3857
  • 博客积分: 6409
  • 博客等级: 准将
  • 技术积分: 15948
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-02 16:48
个人简介

迷彩 潜伏 隐蔽 伪装

文章分类

全部博文(3857)

文章存档

2017年(5)

2016年(63)

2015年(927)

2014年(677)

2013年(807)

2012年(1241)

2011年(67)

2010年(7)

2009年(36)

2008年(28)

分类: Mysql/postgreSQL

2013-11-30 13:37:06

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 指定输出文件


阅读(1579) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~