Re: How to log query's from servers ?

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: condor(at)stz-bg(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to log query's from servers ?
Date: 2011-06-06 22:44:02
Message-ID: 4DED5832.5000208@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 06/06/2011 09:26 PM, Condor wrote:

> Can you explain little more how i can use database-level or user-level
> SET commands to set log_statement for only one of them ?

http://www.postgresql.org/docs/current/static/sql-set.html
http://www.postgresql.org/docs/current/static/runtime-config-logging.html
http://www.postgresql.org/docs/current/static/sql-alteruser.html
http://www.postgresql.org/docs/current/static/sql-alterdatabase.html

You might, for example:

ALTER USER user1 SET log_statement = 'all';
ALTER USER user2 SET log_statement = 'none';

or do the same with ALTER DATABASE ... SET if you wanted to log on a
per-database level.

> Probably, a little filter or patch on postgresql source code file which
> manage logs to write log file
> only if ip is the ip that i want will save me.

Rather than patching PostgreSQL I would recommend configuring PostgreSQL
to log through a smarter syslog daemon like rsyslogd or syslogd-ng . You
should then be able to use regular expression filters in the syslog
daemon to discard log messages you are not interested in before they are
written to disk.

--
Craig Ringer

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2011-06-06 22:54:07 Re: Recurring events
Previous Message Alvaro Herrera 2011-06-06 21:59:31 Re: Postmaster holding unlinked files for pg_largeobject table