Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1051106
  • 博文数量: 171
  • 博客积分: 55
  • 博客等级: 民兵
  • 技术积分: 2077
  • 用 户 组: 普通用户
  • 注册时间: 2012-01-04 10:11
个人简介

pugna

文章分类

全部博文(171)

文章存档

2021年(4)

2020年(1)

2019年(4)

2018年(5)

2017年(7)

2016年(9)

2015年(36)

2014年(8)

2013年(96)

2012年(1)

分类: Mysql/postgreSQL

2013-11-28 17:10:37

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) |
给主人留下些什么吧!~~