X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 715BA3B545C for ; Thu, 16 Dec 2004 00:09:17 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88676-04 for ; Thu, 16 Dec 2004 00:09:08 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id C275E3B5513 for ; Thu, 16 Dec 2004 00:09:10 +0000 (GMT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id iBG099v07993; Wed, 15 Dec 2004 19:09:09 -0500 (EST) From: Bruce Momjian Message-Id: <200412160009.iBG099v07993@candle.pha.pa.us> Subject: Re: indentifying the database in a Postgres log file. In-Reply-To: <16C0CF355FA04944A69E5A4F5299D30B110E9C@ganesh.au.lpint.net> To: Theo Galanakis Date: Wed, 15 Dec 2004 19:09:09 -0500 (EST) Cc: pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL108 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200412/199 X-Sequence-Number: 9574 Theo Galanakis wrote: > > I have written a program that parses a syslog file, reading all the postgres > transactions. I would like to know if there is a way for postgres to log > also the specific database the sql statement originated from. > > The only options available in the postgresql.conf are: > #log_connections = false > #log_duration = false > #log_pid = false > #log_statement = false > #log_timestamp = false > #log_hostname = false > #log_source_port = false > > Is this possible? Or is there a smart work around. In pre-8.0 the only way to do it is to log connections, grab the database from there, and add the pid to join all log rows back to the server row. In 8.0 we have log_line_prefix that can display all information. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073