Re: logging hook for database audit - Mailing list pgsql-hackers

From Itagaki Takahiro
Subject Re: logging hook for database audit
Date
Msg-id 20090914124324.E182.52131E4D@oss.ntt.co.jp
Whole thread Raw
In response to Re: logging hook for database audit  (Magnus Hagander <magnus@hagander.net>)
List pgsql-hackers
Magnus Hagander <magnus@hagander.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
numberof categories are restricted to 30 or so, because category   filtera are managed with bits32. Categorized
messagesshould 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




pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Rough draft: easier translation of psql help
Next
From: Scott Mohekey
Date:
Subject: Timestamp to time_t