log database in which error occurs

From: Alexander Pyhalov <alp(at)rsu(dot)ru>
To: pgsql-general(at)postgresql(dot)org
Subject: log database in which error occurs
Date: 2010-05-11 07:53:37
Message-ID: 4BE90D01.1040506@rsu.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello.
We have postgresql 8.4 server with about 40 databases. Postgres logs
error statements, but it's quite difficult to determine which users on
which databases caused error. For example, this is a piece of log:

May 11 01:36:46 pgsql pgsql[73794]: [7-1] ERROR: 42601: syntax error at
or near "(" at character 50
May 11 01:36:46 pgsql pgsql[73794]: [7-2] LOCATION: base_yyerror,
scan.l:907
May 11 01:36:46 pgsql pgsql[73794]: [7-3] STATEMENT: select count(*)
from forum_msg where grp_id=6709 (200 ok) ACCEPTED and is_blocked='f'

Are there any ways to log database, to which invalid query was issued ?
Are there any ways to separate general server errors and errors per each
database in several log files? I'd like general errors like SEVERE ones
to go to the /var/log/postgresql/general.log, and per-db errors on user
queries go to the /var/log/postgresql/db_$dbname.log .

--
Best regards,
Alexander Pyhalov,
system administrator of Computer Center of South Federal University

Responses

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2010-05-11 08:27:06 Re: log database in which error occurs
Previous Message venu madhav 2010-05-11 07:28:17 Re: Performance issues when the number of records are around 10 Million