Share via


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.

Important

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.

Request

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 https://management.core.windows.net:8443/{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

None.

Response

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="https://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">  
  <ServiceResource>  
    <Name>60testdb2013-08-21T10:00:00connectivityconnection_successful0</Name>  
    <Type>Microsoft.SqlAzure.EventLog</Type>  
    <State>Normal</State>  
    <SelfLink>https://management.core.windows.net/00000000-0000-0000-0001-000000000001/services/sqlservers/servers/bpr0d6li5t/events/60testdb2013-08-21T10:00:00connectivityconnection_successful0</SelfLink>  
    <ParentLink>https://management.core.windows.net/00000000-0000-0000-0001-000000000001/services/sqlservers/servers/bpr0d6li5t</ParentLink>  
    <DatabaseName>testdb</DatabaseName>  
    <StartTimeUtc>2013-08-21T10:00:00</StartTimeUtc>  
    <IntervalSizeInMinutes>60</IntervalSizeInMinutes>  
    <EventCategory>connectivity</EventCategory>  
    <EventType>connection_successful</EventType>  
    <EventSubtype>0</EventSubtype>  
    <EventSubtypeDescription>connection_successful</EventSubtypeDescription>  
    <NumberOfEvents>1</NumberOfEvents>  
    <Severity>0</Severity>  
    <Description>Connected successfully to database.</Description>  
    <AdditionalData i:nil="true"/>  
  </ServiceResource>  
</ServiceResources>  

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