I am looking for a solution to track object usage in my database. Objects such as tables, stored procedures, and functions.
I discovered SQL Auditing and was under the impression that it's exactly what I needed.
So I set it up to audit SELECT
, INSERT
, UPDATE
, DELETE
on my tables, and EXECUTE
on my stored procedures and functions.
I set it up to target the Windows Security event log via Event Viewer Utility.
I made sure to allow permissions and set object access in Local Security Policy and using auditpol.exe
.
Then I ran some INSERTs
on tables and EXECUTEs
on stored procedures. I then opened Event Viewer expecting to see logs of the time each of these statements where executed and on what object, however all I see is this:
Did I skip a step, am looking in the wrong place, or did I make a mistake from the beginning about what SQL Audit actually does?
EDIT: OK, I switch the target to a file and viewed the file via SSMS (right clicking Audit -> View Audit File)... and here the INSERTs
and other actions are indeed being logged....So clearly I'm looking in the wrong place in the Event Viewer or missing something.