Get Database Event Logs (classic)


THIS TOPIC APPLIES TO: noSQL Server yesAzure SQL DatabaseyesAzure SQL Data Warehouse noParallel Data Warehouse

Gets event logs for an Azure SQL Database.


The recommended REST commands to work with SQL Database are the Resource Manager based Azure SQL Database REST API. While there is no change to SQL Database, be aware that the classic deployment model command in this article is scheduled for deprecation on December 1, 2019. For a table providing links to the specific new commands you should use, see Operations for Azure SQL Databases.


The Get Database Event Logs request must be specified as follows:

  • Replace {subscriptionId} with your subscription ID.

  • Replace {serverName} with the name of the server that contains the database with the event logs you want.

  • Replace {databaseName} with the name of the database to retrieve the event logs from.

  • Replace {startDate} with the date and time to start retrieving the event logs.

  • Replace {intervalSizeInMinutes} with the size of the event logs to retrieve; 5, 60, or 1440 minutes.

  • Replace {eventTypes} with the event types to retrieve.

Method Request URI HTTP Version
GET{subscriptionId}/services/sqlservers/servers/{serverName}/databases/{databaseName}/events?startDate={startDate}&intervalSizeInMinutes={intervalSizeInMinutes}&eventTypes={eventTypes} HTTP/1.1

URI Parameters

The following table describes the URI parameters:

URI Parameter Description
startDate The starting date and time of the events to retrieve in UTC format, for example '2011-09-28 16:05:00'.
intervalSizeInMinutes The number of minutes of log entries to retrieve. Valid values are:

- 5
- 60
- 1440
eventTypes The event type of the log entries to retrieve. Valid values are:

- connection_successful
- connection_failed
- connection_terminated
- deadlock
- throttling
- throttling_long_transaction

*To return all event types pass in an empty string.

Request Headers

The following table describes the required and optional request headers:

Request Header Description
x-ms-version Required. Specifies the version of the operation to use for this request. This header should be set to 2012-03-01.

Request Body



The response includes an HTTP status code, a set of response headers, and a response body.

Status Code

Response Headers

The response for this operation includes the following headers. The response may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.

Response Header Description
x-ms-request-id A value that uniquely identifies a request made against the database management service. This request id is used for request tracking. If a failure occurs that requires the user to contact Microsoft Support, the request id should be provided to Microsoft to assist in tracking and resolving the failure for the request.

Response Body

The following is an example response body:

<ServiceResources xmlns="" xmlns:i="">  
    <Description>Connected successfully to database.</Description>  
    <AdditionalData i:nil="true"/>  

The following table describes the elements in the request body:

Element Name Description
Name The name of the event log.
Type The type of the service resource; Microsoft.SqlAzure.EventLog.
State The state of the service resource.
SelfLink The URI identifier for this resource.
ParentLink The URI identifier for the parent of this resource (the server).
DatabaseName The name of the database this log is from.
StartTimeUtc Starting time of the event log.
IntervalSizeInMinutes The number of minutes of aggregate log entries.
EventCategory The event category of the log entries.
EventType The event type of the log entries.
EventSubtype The event subtype of the log entries.
EventSubtypeDescription The description of the event subtype.
NumberOfEvents Number of aggregate events.
Severity Specifies the severity of the event subtype.
Description Specifies the description of the event.

See Also

Common REST API Error Codes
Operations for Azure SQL Databases
Get Server Event Logs (classic)
Azure SQL Database
Azure SQL Database Cmdlets