Re: [HACKERS] Full (special) logs for specified users/hosts/etc

2013-05-17 Thread Heikki Linnakangas

On 17.05.2013 12:29, Nikolay Samokhvalov wrote:

Hello hackers,

Consider a Postgres cluster containing several DBs (for example several
projects/sites). If one wants to optimize queries on one specified site --
what should he do? His obvious need is to switch full logging for the exact
database on, collect the logs and analyze them using pgFouine/pgBadger.

But currently, there is no way to specify log settings for one database /
one user / one host. There are only *global* settings in postgres.conf.


alter database postgres set log_statement='all'

alter user foo set log_statement='all'

- Heikki


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Full (special) logs for specified users/hosts/etc

2013-05-17 Thread Victor Yegorov
2013/5/17 Nikolay Samokhvalov 

> Consider a Postgres cluster containing several DBs (for example several
> projects/sites). If one wants to optimize queries on one specified site --
> what should he do? His obvious need is to switch full logging for the exact
> database on, collect the logs and analyze them using pgFouine/pgBadger.
>
> But currently, there is no way to specify log settings for one database /
> one user / one host. There are only *global* settings in postgres.conf.
>
> We experienced this problem in various project several times already.
> Usually it is  solved with initdb-ing separate cluster, what is annoying
> and difficult if you have replication installed and working.
>
> How difficult is to implement *local* logging settings per
> database/user/host? Is it worth to work on for future versions?
>

Not exactly suitable for pgBadger, but one could setup “csvlog” format,
load logs into the dedicated table and analyse with SQL statements:
http://www.postgresql.org/docs/current/interactive/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-CSVLOG

I'm using this approach for quite some time.

-- 
Victor Y. Yegorov


[HACKERS] Full (special) logs for specified users/hosts/etc

2013-05-17 Thread Nikolay Samokhvalov
Hello hackers,

Consider a Postgres cluster containing several DBs (for example several
projects/sites). If one wants to optimize queries on one specified site --
what should he do? His obvious need is to switch full logging for the exact
database on, collect the logs and analyze them using pgFouine/pgBadger.

But currently, there is no way to specify log settings for one database /
one user / one host. There are only *global* settings in postgres.conf.

We experienced this problem in various project several times already.
Usually it is  solved with initdb-ing separate cluster, what is annoying
and difficult if you have replication installed and working.

How difficult is to implement *local* logging settings per
database/user/host? Is it worth to work on for future versions?