Skip to content

Latest commit

 

History

History
99 lines (81 loc) · 5.86 KB

File metadata and controls

99 lines (81 loc) · 5.86 KB
description CREATE SERVER AUDIT SPECIFICATION (Transact-SQL)
title CREATE SERVER AUDIT SPECIFICATION (Transact-SQL) | Microsoft Docs
ms.custom
ms.date 03/14/2017
ms.prod sql
ms.prod_service sql-database
ms.reviewer
ms.technology t-sql
ms.topic language-reference
f1_keywords
CREATE_SERVER_AUDIT_SPECIFICATION_TSQL
CREATE SERVER AUDIT SPECIFICATION
dev_langs
TSQL
helpviewer_keywords
CREATE SERVER AUDIT SPECIFICATION statement
ms.assetid db77fa77-fedb-40ac-83e6-06343063e518
author VanMSFT
ms.author vanto

CREATE SERVER AUDIT SPECIFICATION (Transact-SQL)

[!INCLUDE SQL Server - ASDBMI]

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

Topic link icon Transact-SQL Syntax Conventions

Syntax

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

[!INCLUDEsql-server-tsql-previous-offline-documentation]

Arguments

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.

Remarks

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.

Permissions

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 users CONTROL SERVER permission, the sysadmin account, or principals having explicit access to the audit.

Examples

The following example creates a server audit specification called HIPAA_Audit_Specification that audits failed logins, for a [!INCLUDEssNoVersion] Audit called HIPAA_Audit.

CREATE SERVER AUDIT SPECIFICATION HIPAA_Audit_Specification  
FOR SERVER AUDIT HIPAA_Audit  
    ADD (FAILED_LOGIN_GROUP)  
    WITH (STATE=ON);  
GO  

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

See Also

CREATE SERVER AUDIT (Transact-SQL)
ALTER SERVER AUDIT (Transact-SQL)
DROP SERVER AUDIT (Transact-SQL)
ALTER SERVER AUDIT SPECIFICATION (Transact-SQL)
DROP SERVER AUDIT SPECIFICATION (Transact-SQL)
CREATE DATABASE AUDIT SPECIFICATION (Transact-SQL)
ALTER DATABASE AUDIT SPECIFICATION (Transact-SQL)
DROP DATABASE AUDIT SPECIFICATION (Transact-SQL)
ALTER AUTHORIZATION (Transact-SQL)
sys.fn_get_audit_file (Transact-SQL)
sys.server_audits (Transact-SQL)
sys.server_file_audits (Transact-SQL)
sys.server_audit_specifications (Transact-SQL)
sys.server_audit_specification_details (Transact-SQL)
sys.database_audit_specifications (Transact-SQL)
sys.database_audit_specification_details (Transact-SQL)
sys.dm_server_audit_status (Transact-SQL)
sys.dm_audit_actions (Transact-SQL)
Create a Server Audit and Server Audit Specification