Обсуждение: Filter logging by table

Поиск
Список
Период
Сортировка

Filter logging by table

От
"Yves Lavoie, GaYLi"
Дата:
Hi PG Gurus,

I need to filter out logging for some tables. We have an application
which often query for a settings table and for pg_proc. This pollutes
postgresql.log with numerous useless queries and we are looking for a
way to skip logging entirely for those. Any suggestion?

Thanks,

Yves Lavoie


Re: Filter logging by table

От
Guillaume Lelarge
Дата:
Hi,

2016-11-22 19:19 GMT+01:00 Yves Lavoie, GaYLi <ylavoie@yveslavoie.com>:
Hi PG Gurus,

I need to filter out logging for some tables. We have an application
which often query for a settings table and for pg_proc. This pollutes
postgresql.log with numerous useless queries and we are looking for a
way to skip logging entirely for those. Any suggestion?


There's no way to do that natively with PostgreSQL. But perhaps some extensions can help you get that, though I know none that would.


--

Re: Filter logging by table

От
"David G. Johnston"
Дата:
On Tue, Nov 22, 2016 at 11:19 AM, Yves Lavoie, GaYLi <ylavoie@yveslavoie.com> wrote:
Hi PG Gurus,

I need to filter out logging for some tables. We have an application
which often query for a settings table and for pg_proc. This pollutes
postgresql.log with numerous useless queries and we are looking for a
way to skip logging entirely for those. Any suggestion?

​Don't know for sure if this will work but I'd probably wrap the relevant query in a function and add "SET log_statements = none" at the top.  You'll need to make the function "security definer" and make it owned by a superuser.


David J.