Database Reference
In-Depth Information
Run the following:
pgfouine.php -file /var/log/postgressql/postgresql-9.0-main.log.1
-reports n-mostfrequenterrors > errors.html
You can also set it up to e-mail the generated error report to the DBA at that time.
How it works...
PgFouine condenses and ranks error messages for easy viewing, and produces a nicely
formatted report in HTML. From that report, you can find out the most frequent errors.
As a rule, it is a good practice not to tolerate errors in database logs if you can avoid it. Once
the errors start showing up in the log and report, you should find the cause of the errors and
fix them.
While it is tempting to leave the errors there, as they do no harm and consider them just a
small nuisance, it is often true, that simple errors are indication of other problems in the
application, which if not found and understood may lead to all kinds of larger problems, such
as security breaches or eventual data corruption at the logical level.
There's more...
Writing your own log processor
If you have only a small number of errors in your log files, then it may be sufficient to just run
each logfile through grep to find errors:
user@dbhost: $ egrep "FATAL|ERROR" postgresql-9.0-main.log
See also
F Home page for pgFouine is at the following website:
http://pgfouine.projects.postgresql.org/
F You can get much more information on setting up pgFouine at the following URL:
http://pgfouine.projects.postgresql.org/tutorial.html
F Another similar tool is PQA (Practical Query Analysis), available at the following URL:
http://pqa.projects.postgresql.org/
PQA is written in Ruby, so if you are good at using Ruby, you may prefer this one .
In PostgreSQL 9.0, there is also a contrib module pg_stat_statements that captures query
execution statistics in real time. See the documentation at the following URL:
http://www.postgresql.org/docs/9.0/interactive/pgstatstatements.html
 
Search WWH ::




Custom Search