Export (0) Print
Expand All
Expand Minimize

CREATE SERVER AUDIT SPECIFICATION (Transact-SQL)

Creates a server audit specification object using the SQL Server Audit feature. For more information, see SQL Server Audit (Database Engine).

Applies to: SQL Server (SQL Server 2008 through current version).

Topic link icon Transact-SQL Syntax Conventions

CREATE SERVER AUDIT SPECIFICATION audit_specification_name
FOR SERVER AUDIT audit_name
{
    { ADD ( { audit_action_group_name } ) 
    } [, ...n]
    [ WITH ( STATE = { ON | OFF } ) ]
}
[ ; ]

audit_specification_name

Name of the server audit specification.

audit_name

Name of the audit to which this specification is applied.

audit_action_group_name

Name of a group of server-level auditable actions. For a list of Audit Action Groups, see SQL Server Audit Action Groups and Actions.

WITH ( STATE = { ON | OFF } )

Enables or disables the audit from collecting records for this audit specification.

An audit must exist before creating a server audit specification for it. When a server audit specification is created, it is in a disabled state.

Users with the ALTER ANY SERVER AUDIT permission can create server audit specifications and bind them to any audit.

After a server audit specification is created, it can be viewed by principals with the, CONTROL SERVER, or ALTER ANY SERVER AUDIT permissions, the sysadmin account, or principals having explicit access to the audit.

The following example creates a server audit specification called HIPPA_Audit_Specification that audits failed logins, for a SQL Server Audit called HIPPA_Audit.

CREATE SERVER AUDIT SPECIFICATION HIPPA_Audit_Specification
FOR SERVER AUDIT HIPPA_Audit
    ADD (FAILED_LOGIN_GROUP);
GO

For a full example about how to create an audit, see SQL Server Audit (Database Engine).

Community Additions

ADD
Show:
© 2014 Microsoft