Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Viewing and Downloading Audit Logs

Updated on 2024-10-24 GMT+08:00

The SQL audit function is enabled by default for Microsoft SQL Server DB instances and cannot be disabled. Major change operations on services, databases, and tables are recorded in audit log files for future query and download.

RDS for SQL Server Audit enables you to audit server-level and database-level groups of events and individual events. RDS for SQL Server audits consist of zero or more audit action items. Table 1 shows the server-level audit action groups and provides the equivalent RDS for SQL Server Event Class where applicable. For more information, see SQL Server Audit Action Groups and Actions.

NOTE:
  • The maximum size of an audit log file is 50 MB. Up to 50 audit log files can be displayed.
  • RDS for SQL Server 2008 Web and Standard Editions do not support the SQL audit function.
  • No audit is performed for job creation and modifications on parameters, server attribute parameters, SQL agent attribute parameters, and database extended attribute parameters.
  • The succeeded parameter displayed in the audit log indicates whether the event is triggered successfully. Its value cannot be null. For all events except login events, only the success or failure of the permission check (not the operation) is reported.
  • For details about the audit of table-level and column-level architecture changes, see the audit result of the SQL Server engine.
  • To read audit logs, you can obtain the audit log file name from the console and then run the following statement:

    select * from msdb.dbo.rds_fn_get_audit_file('D:\ServerAudit\audit\RDSAudit_test.sqlaudit', default, default)

    If you have already downloaded the audit log file to a local directory, log in to your local SQL Server database and then run the following statement (the local account must have the CONTROL SERVER permission):

    select * from sys.fn_get_audit_file('\\path\RDSAudit_test.sqlaudit', default, default)

Table 1 Audit action groups

Action Group Name

Description

APPLICATION_ROLE_CHANGE_PASSWORD_GROUP

This event is raised whenever a password is changed for an application role.

DATABASE_CHANGE_GROUP

This event is raised when a database is created, altered, or dropped.

DATABASE_OBJECT_CHANGE_GROUP

This event is raised when a CREATE, ALTER, or DROP statement is executed on database objects, such as schemas.

DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP

This event is raised when a change of owner for objects within database scope.

DATABASE_OBJECT_PERMISSION_CHANGE_GROUP

This event is raised when a GRANT, REVOKE, or DENY has been issued for database objects, such as assemblies and schemas.

DATABASE_OWNERSHIP_CHANGE_GROUP

This event is raised when you use the ALTER AUTHORIZATION statement to change the owner of a database.

DATABASE_PERMISSION_CHANGE_GROUP

This event is raised whenever a GRANT, REVOKE, or DENY is issued for a statement permission by any user in SQL Server for database-only events such as granting permissions on a database.

DATABASE_PRINCIPAL_CHANGE_GROUP

This event is raised when principals, such as users, are created, altered, or dropped from a database.

DATABASE_ROLE_MEMBER_CHANGE_GROUP

This event is raised whenever a login is added to or removed from a database role.

FAILED_LOGIN_GROUP

Indicates that a principal tried to log on to a SQL Server database and failed. Events in this class are raised by new connections or by connections that are reused from a connection pool.

LOGIN_CHANGE_PASSWORD_GROUP

This event is raised whenever a login password is changed by way of ALTER LOGIN statement or sp_password stored procedure.

SCHEMA_OBJECT_CHANGE_GROUP

This event is raised when a CREATE, ALTER, or DROP operation is performed on a schema.

SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP

This event is raised when the permissions to change the owner of schema object (such as a table, procedure, or function) is checked.

SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP

This event is raised whenever a grant, deny, revoke is performed against a schema object.

SERVER_OBJECT_CHANGE_GROUP

This event is raised for CREATE, ALTER, or DROP operations on server objects.

SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP

This event is raised when the owner is changed for objects in server scope.

SERVER_OBJECT_PERMISSION_CHANGE_GROUP

This event is raised whenever a GRANT, REVOKE, or DENY is issued for a server object permission by any principal in SQL Server.

SERVER_PERMISSION_CHANGE_GROUP

This event is raised when a GRANT, REVOKE, or DENY is issued for permissions in the server scope.

SERVER_PRINCIPAL_CHANGE_GROUP

This event is raised when server principals are created, altered, or dropped.

SERVER_ROLE_MEMBER_CHANGE_GROUP

This event is raised whenever a login is added or removed from a fixed server role.

SERVER_STATE_CHANGE_GROUP

This event is raised when the SQL Server service state is modified.

USER_CHANGE_PASSWORD_GROUP

This event is raised whenever the password of a contained database user is changed by using the ALTER USER statement (SQL Server 2008 is not involved).

Querying Audit Logs

  1. Log in to the management console.
  2. Click in the upper left corner and select a region.
  3. Click in the upper left corner of the page and choose Databases > Relational Database Service.
  4. On the Instances page, click the target instance name.
  5. In the navigation pane on the left, choose Logs. On the System Logs page, click Downloads.
  6. On the Downloads page, record the names of audit logs.

    Figure 1 RDS for SQL Server audit logs
    NOTE:

    The audit log name starts with RDSAudit. The system automatically adds the GUID and timestamp to the file name as a suffix.

  7. Connect to the DB instance through the Microsoft SQL Server client. For details, see Connecting to a DB Instance Through a Public Network.
  8. After the DB instance is connected, run the following command to view details about SQL audit logs:

    select * from msdb.dbo.rds_fn_get_audit_file(file_pattern, initial_file_name, audit_record_offset)

    Table 2 Parameter description

    Parameter

    Description

    file_pattern

    Specifies the directory or path and file name for the audit file set to be read.

    initial_file_name

    Specifies the path and name of a specific file in the audit file set to start reading audit records from.

    audit_record_offset

    Specifies a known location with the file specified for the initial_file_name.

    Example:

    select * from msdb.dbo.rds_fn_get_audit_file('D:\ServerAudit\audit\*.sqlaudit', default, default)

    Figure 2 Audit log details

Downloading SQL Audit Logs

  1. Log in to the management console.
  2. Click in the upper left corner and select a region.
  3. Click in the upper left corner of the page and choose Databases > Relational Database Service.
  4. On the Instances page, click the target instance name.
  5. In the navigation pane on the left, choose Logs. On the System Logs page, click Downloads.
  6. Locate a log to be downloaded and click Download in the Operation column.

    1. The system automatically loads the downloading preparation tasks. The loading duration is determined by the log file size and network environment.
      • When the log is being prepared for download, the log status is Preparing.
      • When the log is ready for download, the log status is Preparation completed.
      • If the preparation for download fails, the log status is Abnormal.
    2. In the displayed dialog box, click OK to download the log whose status is Preparation completed. If you click Cancel, the system does not download the log.

      The download link is valid for 5 minutes. After the download link expires, a message is displayed indicating that the download link has expired. You can close the window and repeat the procedure 6 to try to download a log again.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback