Handy DQL: What is being audited?

Whether we need to configure auditing for a new solution or figure out why some event was not audited, we may have to answer the question, “What is currently being audited in my repository?” Here are some handy queries to help you do just that.

List all configured audit events

This query is not very helpful other than getting the total count and the object ID’s. The queries that follow later join with various types to provide user-friendly information.

select r.registered_id, r.event,r.user_name
from dmi_registry r
where r.is_audittrail = 1

Across-the-board  audit configuration

select 'ALL',r.event,r.user_name
from dmi_registry r
where r.is_audittrail = 1
and r.registered_id = '0000000000000000'

Audit configuration for types

select t.name,r.event,r.user_name
from dmi_registry r, dm_type t
where r.is_audittrail = 1
and t.r_object_id = r.registered_id

Audit configuration for Sysobjects

select t.object_name,r.event,r.user_name
from dmi_registry r, dm_sysobject t
where r.is_audittrail = 1
and t.r_object_id = r.registered_id

Audit configuration for users

select t.user_name,r.event,r.user_name
from dmi_registry r, dm_user t
where r.is_audittrail = 1
and t.r_object_id = r.registered_id

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s