Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
Security (SS2K8)
»
Failure audits
Failure audits
Rate Topic
Display Mode
Topic Options
Author
Message
PHXHoward
PHXHoward
Posted Monday, January 09, 2012 11:17 AM
SSC Veteran
Group: General Forum Members
Last Login: Yesterday @ 4:32 PM
Points: 250,
Visits: 693
Hello, I have enabled SQL Server Audit to write to the Application event log. Seems to be working fine but it is only logging success. How do I enable failure logging for things like select/insert/update/delete?
Thanks for reading.
Howard
Post #1232685
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Monday, January 09, 2012 11:43 AM
SSC-Dedicated
Group: Administrators
Last Login: Today @ 4:46 PM
Points: 31,433,
Visits: 13,745
There is no logging for insert/update/deletes. You can enable SQL Trace, but you are potentially asking for a ton of data.
What are you trying to accomplish? Typically there isn't a "failure" of a select/insert/update/delete on a regular basis.
Follow me on Twitter:
@way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
Post #1232702
PHXHoward
PHXHoward
Posted Monday, January 09, 2012 11:58 AM
SSC Veteran
Group: General Forum Members
Last Login: Yesterday @ 4:32 PM
Points: 250,
Visits: 693
SQL Server 2008 Audit allows auditing of a number of things including select/insert/update/delete. It is working properly for capturing these events to the Windows Application or event log but it is only capturing Audit Success. I have a requirement to capture audit failures too such as a select of a table that does not exist or where the user does not have access. I think it may be an option in the audit policy but not sure how to set it.
Here is an example entry:
Date 1/9/2012 6:51:27 PM
Log Audit Collection (Audit-20120109-115026)
Event Time 18:51:27.9823720
Server Instance Name <name here>
Action ID SELECT
Class Type TABLE
Sequence Number 1
Succeeded True
Permission Bit Mask 0x0000000000000001
Column Permission True
Session ID 61
Server Principal ID 259
Database Principal ID 1
Target Server Principal ID 0
Target Database Principal ID 0
Object ID 530100929
Session Server Principal Name <user name>
Server Principal Name <user name>
Server Principal SID <id>
Database Principal Name dbo
Target Server Principal Name
Target Server Principal SID NULL
Target Database Principal Name
Database Name DBA_Maintenance
Schema Name dbo
Object Name test
Statement select * FROM [DBA_Maintenance].[dbo].[test]
Additional Information
File Name D:\dba\Audit-20120109-115026_xxx.sqlaudit
File Offset 6144
User Defined Event ID 0
User Defined Information
Message
Post #1232714
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Monday, January 09, 2012 12:29 PM
SSC-Dedicated
Group: Administrators
Last Login: Today @ 4:46 PM
Points: 31,433,
Visits: 13,745
Sorry, was thinking of something else when I posted, not SQL Server Audit, as in the feature.
In terms of auditing the SELECT/INSERT/UPDATE/DELETE, a database audit specification will do this, but it audits the execution of the statement. A "failure" isn't a failure of the statement. It's another error. If someone executes a SELECT against a non-existent table, that's not a SELECT failure, that could be seen as a syntax error, or an object reference error, but the SELECT hasn't failed. An insert that has a duplicate key value is an FK error, not an insert error.
If I understand it correctly from limited use, you will get all executions of the statement, which is defined per object, and you'd have to sort through them, maybe filtering on some keyword in the logs. I'm not sure you can limit it to just one particular type of execution.
Understanding Audit -
http://msdn.microsoft.com/en-us/library/cc280386%28v=SQL.100%29.aspx
Create DB spec -
http://msdn.microsoft.com/en-us/library/cc280404%28v=SQL.100%29.aspx
Follow me on Twitter:
@way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
Post #1232737
PHXHoward
PHXHoward
Posted Wednesday, January 11, 2012 12:36 PM
SSC Veteran
Group: General Forum Members
Last Login: Yesterday @ 4:32 PM
Points: 250,
Visits: 693
Thanks for helping me to understand.
I see now that if I give a user read only permission and they attempt to update a table, it will log a failure. This is very good.
The confusion was when I was expecting a user who runs a bad query such as a select of a table that does not exist that it would record that as well. But technicly as you say, it is a successful select but of non existant data. These type of things are not logged by SQL Server Audit but would help us to detect anyone who was fishing for data.
Thanks again.
Post #1234298
Roy Ernest
Roy Ernest
Posted Thursday, January 12, 2012 10:47 AM
Hall of Fame
Group: General Forum Members
Last Login: 2 days ago @ 7:52 AM
Points: 3,280,
Visits: 6,622
You could always go another route. That is to put a sniffer in front of the SQL Server that logs all incoming traffic. You do not need to log the Output. (It will be way too much data)
-Roy
Post #1235100
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.