One embodiment of the present invention provides a system that selectively
audits accesses to a relational database system. This system starts by
receiving a query from a client at a database server. The system
processes this query at the database server to produce a query result.
The system also creates an audit record for rows in relational tables
that are accessed by the query, and that satisfy an auditing condition.
Next, the system records the audit record in an audit record store and
returns the query result to the client. Integrating the auditing facility
into the relational database system in this manner ensures that auditing
is performed in the same way regardless of which application generates
the query. Furthermore, this auditing is transparent to applications and
users. In one embodiment of the present invention, the system
additionally modifies the query so that processing the query causes the
audit record to be created and recorded for rows in relational tables
that are accessed by the query and that satisfy the auditing condition.
In a variation on this embodiment, the auditing condition is associated
with a table in the relational database system.