Author: devrim
Update of /cvs/extras/rpms/pgfouine/devel In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv19248/devel
Modified Files: .cvsignore sources Added Files: pgfouine-0.7-include_path.patch pgfouine-tutorial.txt pgfouine.spec Log Message: auto-import pgfouine-0.7.1-2 on branch devel from pgfouine-0.7.1-2.src.rpm
pgfouine-0.7-include_path.patch:
--- NEW FILE pgfouine-0.7-include_path.patch --- --- pgfouine_vacuum.php.orig 2006-08-11 00:13:57.797229593 +0200 +++ pgfouine_vacuum.php 2006-08-11 00:15:16.800770504 +0200 @@ -30,6 +30,8 @@ error_reporting(E_ALL); }
+ini_set('include_path', '@INCLUDEPATH@'); + include('version.php'); require_once('include/lib/common.lib.php'); require_once('include/base.lib.php');
--- pgfouine.php.orig 2006-08-11 00:17:07.628330143 +0200 +++ pgfouine.php 2006-08-11 00:18:39.298492488 +0200 @@ -30,6 +30,8 @@ error_reporting(E_ALL); }
+ini_set('include_path', '@INCLUDEPATH@'); + include('version.php'); require_once('include/lib/common.lib.php'); require_once('include/base.lib.php');
--- NEW FILE pgfouine-tutorial.txt --- Installation instructions & Tutorial Installation
You can either untar the pgFouine tarball or install the RPM package.
* If you use the tarball, pgFouine is installed locally and can be run with ./pgfouine.php in the directory where you installed it. * If you install the RPM package, pgFouine is installed globally and you can run pgFouine with pgfouine.php.
How to enable query logging PostgreSQL 7.x
Edit your postgresql.conf file (usually located in /var/lib/pgsql/data/) and set the following configuration directives:
* To log queries slower than n milliseconds:
syslog = 2 log_min_duration_statement = n log_duration = false log_statement = false
To log every query executed, set log_min_duration_statement to 0. Set it to -1 to disable query logging. * To log queries slower than n milliseconds AND duration for ALL queries (it only works with PostgreSQL 7.x; pgFouine counts every duration only once):
syslog = 2 log_min_duration_statement = n log_duration = true log_statement = false
Then edit your /etc/syslog.conf to set up a PostgreSQL facility:
local0.* -/var/log/pgsql
You should also ignore PostgreSQL facility for the default log file otherwise you will log the queries twice:
*.info;mail.none;authpriv.none;cron.none;local0.none /var/log/messages
Restart syslogd and PostgreSQL.
Apart from the extra I/O, the overhead of logging is barely noticeable. You can set syslog to send the log to another server through the network with @ip.ad.dr.ess.
PostgreSQL 8.x Syslog configuration
Edit your postgresql.conf file (usually located in /var/lib/pgsql/data/) and set the following configuration directives:
* To enable syslog logging:
log_destination = 'syslog' redirect_stderr = off silent_mode = on
* To log queries slower than n milliseconds:
log_min_duration_statement = n log_duration = off log_statement = 'none'
To log every query executed, set log_min_duration_statement to 0. Set it to -1 to disable query logging.
Then edit your /etc/syslog.conf to set up a PostgreSQL facility:
local0.* -/var/log/pgsql
You should also ignore PostgreSQL facility for the default log file otherwise you will log the queries twice:
*.info;mail.none;authpriv.none;cron.none;local0.none /var/log/messages
Restart syslogd and PostgreSQL.
Apart from the extra I/O, the overhead of logging is barely noticeable. You can set syslog to send the log to another server through the network with @ip.ad.dr.ess.
Filter on database and/or user
You can filter your log file on database and user using the -database and -user options. To do so, you need to configure the following log_line_prefix:
log_line_prefix = 'user=%u,db=%d'
Using stderr log file
Using the following configuration, you can log to stderr instead of syslog. This is not recommended as we cannot guarantee the consistency of statements if they are multilines.
log_destination = 'stderr' redirect_stderr = on log_line_prefix = '%t [%p]: [%l-1] '
Usage
pgFouine is an easy to use command line tool. The following command generates an HTML report with all default options:
$ pgfouine.php -file your/log/file.log > your-report.html
The following command line displays a text report with only 10 queries in each list to the standard output:
$ pgfouine.php -file your/log/file.log -top 10 -format text
By using pgfouine.php -help, you can display the usage information.
--- NEW FILE pgfouine.spec --- Summary: PgFouine PostgreSQL log analyzer Name: pgfouine Version: 0.7.1 Release: 2%{?dist} BuildArch: noarch License: GPL Group: Development/Tools Source0: http://pgfouine.projects.postgresql.org/releases/%%7Bname%7D-%%7Bversion%7D.... Source2: pgfouine-tutorial.txt URL: http://pgfouine.projects.postgresql.org BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Patch1: pgfouine-0.7-include_path.patch
%description pgFouine is a PostgreSQL log analyzer. It generates text or HTML reports from PostgreSQL log files. These reports contain the list of the slowest queries, the queries that take the most time and so on.
pgFouine can also: - analyze VACUUM VERBOSE output to help you improve your VACUUM strategy, - generate Tsung sessions file to benchmark your PostgreSQL server.
%prep %setup -q %patch1 -p0 sed -i 's!@INCLUDEPATH@!%{_datadir}/%{name}!' pgfouine_vacuum.php sed -i 's!@INCLUDEPATH@!%{_datadir}/%{name}!' pgfouine.php
cp %{SOURCE2} .
%build
%install # cleaning build environment rm -rf %{buildroot}
# creating required directories install -m 755 -d %{buildroot}/%{_datadir}/%{name} install -m 755 -d %{buildroot}/%{_bindir}
# installing pgFouine for i in include version.php; do cp -rp $i %{buildroot}/%{_datadir}/%{name}/ done
install -m 755 pgfouine.php %{buildroot}/%{_bindir}/ install -m 755 pgfouine_vacuum.php %{buildroot}/%{_bindir}/
%clean rm -rf %{buildroot}
%files %defattr(-, root, root) %doc AUTHORS ChangeLog COPYING THANKS README pgfouine-tutorial.txt %attr(0755, root, root) %{_bindir}/pgfouine.php %attr(0755, root, root) %{_bindir}/pgfouine_vacuum.php %{_datadir}/%{name}
%changelog * Thu Nov 30 2006 Devrim Gunduz devrim@CommandPrompt.com - 0.7.1-2 - Added tutorial.txt per bugzilla review * Sat Oct 28 2006 Guillaume Smet guillaume-pg@smet.org - 0.7.1-1 - released 0.7.1 * Sun Sep 3 2006 Guillaume Smet guillaume-pg@smet.org - 0.7-4 - fixed spec according to bugzilla #202901 comment #2 * Thu Aug 18 2006 Devrim Gunduz devrim@CommandPrompt.com - 0.7-3 - fixed spec, per bugzilla review * Thu Aug 17 2006 Devrim Gunduz devrim@CommandPrompt.com - 0.7-2 - fixed rpmlint warnings, and made cosmetic changes * Thu Aug 17 2006 Guillaume Smet guillaume-pg@smet.org - released 0.7 * Thu Aug 10 2006 Guillaume Smet guillaume-pg@smet.org - fixed RPM packaging for 0.7 * Wed Jul 19 2006 Guillaume Smet guillaume-pg@smet.org - added pgfouine_vacuum.php * Sun May 21 2006 Guillaume Smet guillaume-pg@smet.org - released 0.6 * Sun Mar 26 2006 Guillaume Smet guillaume-pg@smet.org - released 0.5 * Tue Jan 10 2006 Guillaume Smet guillaume-pg@smet.org - released 0.2.1 * Sun Dec 4 2005 Guillaume Smet guillaume-pg@smet.org - released 0.2 * Fri Nov 18 2005 Guillaume Smet guillaume-pg@smet.org - initial RPM packaging
Index: .cvsignore =================================================================== RCS file: /cvs/extras/rpms/pgfouine/devel/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- .cvsignore 30 Nov 2006 22:27:40 -0000 1.1 +++ .cvsignore 30 Nov 2006 22:28:52 -0000 1.2 @@ -0,0 +1 @@ +pgfouine-0.7.1.tar.gz
Index: sources =================================================================== RCS file: /cvs/extras/rpms/pgfouine/devel/sources,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- sources 30 Nov 2006 22:27:40 -0000 1.1 +++ sources 30 Nov 2006 22:28:52 -0000 1.2 @@ -0,0 +1 @@ +79df9b088a9cd0a7741de0b5857dc3e7 pgfouine-0.7.1.tar.gz
scm-commits@lists.fedoraproject.org