Get Database Event Logs (classic)

 

Updated: October 5, 2016

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

Gets event logs for an Azure SQL Database.

This command uses the classic deployment model. You should use the newer Resource Manager based REST API commands located here. For more information, see Azure Resource Manager vs. classic deployment: Understand deployment models and the state of your resources.

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.

MethodRequest URIHTTP Version
GEThttps://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 ParameterDescription
startDateThe starting date and time of the events to retrieve in UTC format, for example '2011-09-28 16:05:00'.
intervalSizeInMinutesThe number of minutes of log entries to retrieve. Valid values are:

- 5
- 60
- 1440
eventTypesThe 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 HeaderDescription
x-ms-versionRequired. Specifies the version of the operation to use for this request. This header should be set to 2012-03-01.

Request Body

None.

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 HeaderDescription
x-ms-request-idA 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="http://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 NameDescription
NameThe name of the event log.
TypeThe type of the service resource; Microsoft.SqlAzure.EventLog.
StateThe state of the service resource.
SelfLinkThe URI identifier for this resource.
ParentLinkThe URI identifier for the parent of this resource (the server).
DatabaseNameThe name of the database this log is from.
StartTimeUtcStarting time of the event log.
IntervalSizeInMinutesThe number of minutes of aggregate log entries.
EventCategoryThe event category of the log entries.
EventTypeThe event type of the log entries.
EventSubtypeThe event subtype of the log entries.
EventSubtypeDescriptionThe description of the event subtype.
NumberOfEventsNumber of aggregate events.
SeveritySpecifies the severity of the event subtype.
DescriptionSpecifies the description of the event.

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

Show: