From: | Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> |
---|---|
To: | Magnus Hagander <magnus(at)hagander(dot)net> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: logging hook for database audit |
Date: | 2009-09-14 04:02:27 |
Message-ID: | 20090914124324.E182.52131E4D@oss.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> I have been working with josh tolley that changes some infrastructure
> around this, with one of the future goals to be able to implement just
> this kind of features. I need to merge some changes from josh, and
> will then try to post a wip patch as soon as possible. Please look at
> this one before you start working on this - probably theoverlap will
> be very large.
Thanks, it will be helpful.
At the moment, my idea is adding special sqlcodes for some LOG messages.
ERRCODE_SUCCESSFUL_AUTOVACUUM = "00001"
ERRCODE_SUCCESSFUL_CHECKPOINTS = "00002"
...
ereport(LOG, errcode(ERRCODE_SUCCESSFUL_AUTOVACUUM),
errmsg("autovacuum messages")));
New GUC parameters xxx_category is a list of categories.
Only logs listed here is written for each log. The default
values are '*' (all categories). Messages without sqlcodes
are put into "others" category.
{stderr|csvlog|syslog}_category = [ * | autovacuum | ... | others ]
This approach is less impact to the codes and just utilizes unused
sqlcodes of LOG or lower level messages. However, it has some limitations:
* We cannot categorize ERROR or higher level messages
because they've used sqlcodes as original purposes.
* The number of categories are restricted to 30 or so, because category
filtera are managed with bits32. Categorized messages should use
sqlcodes between "00001" and "0000N".
* We need to add sqlcodes for each LOGs. It would be hard work, but
needed anyway if we will support any kinds of per-category log filters.
Comments welcome.
Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Mohekey | 2009-09-14 04:29:03 | Timestamp to time_t |
Previous Message | Alvaro Herrera | 2009-09-14 03:46:46 | Re: Rough draft: easier translation of psql help |