Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On my Mssql 2008r2 I created a server audit for all login and logout:


CREATE SERVER AUDIT audit_test                                           

FOR SERVER AUDIT [audit_test]

For maximum file space I have set 1024 MB, more than enough.

However, when from the SQL Server Management Studio I go to security/audits/audit_test/view audit logs it only displays exactly the latest 1.000 rows. On the other hand, the file produced by the audit is 317 MB, so I guess it has more than 1.000 rows.

I even tried setting a filter, but it did not help: no line appear outside the latest 1.000.

How do I read the audit log file?

share|improve this question
up vote 1 down vote accepted

Have you tried reading your audit using sys.fn_get_audit_file?

-- query all audit files in the D:\audit directory
 FROM sys.fn_get_audit_file('D:\audit\*.sqlaudit', default, default)

The CREATE SERVER audit TSQL command you used did not specify

MAXSIZE = { max_size } The default value is UNLIMITED.

MAX_ROLLOVER_FILES ={ integer | UNLIMITED} The default value is UNLIMITED.

MAX_FILES =integer Specifies the maximum number of audit files that can be created. Does not rollover to the first file when the limit is reached. When the MAX_FILES limit is reached, any action that causes additional audit events to be generated will fail with an error.

Not sure what the default is for MAX_FILES but its probably the FS limit which is somewhere around two billion.

So no there should not be any limit on the size of the audit files generated or the number of rows stored within them.

share|improve this answer
The limits were ok, because I set them in Management Studio. What I was missing was sys.fn_get_audit_file , thanks – carlo.borreo Dec 11 '13 at 8:45
Hello @carlo.borreo OK, didn't think to look there. – Craig Efrein Dec 11 '13 at 8:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.