SQL Server 2008 Audit_Amazing_Expecting Comments

  • We enabled SQL Server external audit feature in our production server. We enabled only DML(Insert,Update,Delete) single audit event instead of group event on database level.Later, we reviewed the audit log file and everything looks good because all DML(Insert,Update,Delete)event was audit from all databases.

    We amazing after seeing one thing, SELECT query was also audited on the file. We checked the action id column through select * from fn_get_audit_file(file_pattern,default,default) and it was showing as UP (it means that update event occurred against SELECT query).

    Below is the query,

    select tbl.name, schema_name(tbl.schema_id), tbl.type, cast(case when tbl.is_ms_shipped = 1 then 1when (select major_id from sys.extended_properties where major_id = tbl.object_id and minor_id = 0 and class = 1 and name = N'microsoft_database_tools_support')is not null then 1 else 0 end as bit)from sys.all_objects AS tbl where tbl.type in (N'U', N'S') and permissions(tbl.object_id) & 4096 <> 0

    Question is : Why SELECT query was audited as UPDATE event?. Any idea? Post your valuable findings. Thanks

    DINESH.D

  • Hi Dinesh, Audit definition might help. could you post here ?

  • Below is the result snippet about audit specification which we enabled on all databases,

    Query :

    =====

    select audit_action_id,audit_action_name,class,audited_result from sys.database_audit_specification_details

    Result :

    =====

    audit_action_idaudit_action_name classaudited_result

    DL DELETE 0SUCCESS AND FAILURE

    IN INSERT 0SUCCESS AND FAILURE

    UP UPDATE 0SUCCESS AND FAILURE

    Reply back if you need any more. Thanks for your effort.

  • I am posting here as you expected through Script button in SSMS.

    SERVER LEVEL AUDIT FILE CREATION

    ================================

    USE [master]

    GO

    CREATE SERVER AUDIT [Server_audit]

    TO FILE

    ( FILEPATH = N'F:\AuditFiles\'

    ,MAXSIZE = 200 MB

    ,MAX_ROLLOVER_FILES = 5

    ,RESERVE_DISK_SPACE = OFF

    )

    WITH

    ( QUEUE_DELAY = 1000

    ,ON_FAILURE = CONTINUE

    ,AUDIT_GUID = 'a12345-0896-4112-b8f7-492d688a6ed3'

    )

    GO

    DATABASE LEVEL DML AUDIT FILE ENABLING

    =======================================

    USE [XXXXX]

    GO

    CREATE DATABASE AUDIT SPECIFICATION [DML_Audit]

    FOR SERVER AUDIT [Server_audit]

    ADD (DELETE ON DATABASE::[XXXXX] BY [public]),

    ADD (INSERT ON DATABASE::[XXXXX] BY [public]),

    ADD (UPDATE ON DATABASE::[XXXXX] BY [public])

    WITH (STATE = ON)

    GO

  • Could you send all the values of table sys.database_audit_specification_details for those UP action ? Seems confusing but will give it a try.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply