Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
When you have critical applications and business processes relying on Azure resources, you want to monitor those resources for their availability, performance, and operation.
This article describes the monitoring data generated by Microsoft Dev Box. Microsoft Dev Box uses Azure Monitor. If you're unfamiliar with the features of Azure Monitor common to all Azure services that use it, read Monitor Azure resources with Azure Monitor.
Prerequisites
To enable logging with Azure Storage, you need a storage account in the same region as your dev center. For more information, see Create an Azure Storage account.
To send Log Analytics for the logs, you need a log analytics workspace. For more information, see Create a Log Analytics workspace in the Azure portal.
Explore data collection and routing for Dev Box
Dev Box collects the same kinds of monitoring data as other Azure resources that are described in Monitor data from Azure resources.
Platform metrics and the Activity log are collected and stored automatically, but this data can be routed to other locations by using a diagnostic setting.
Resource Logs aren't collected and stored until you create a diagnostic setting and route them to one or more locations.
For more information on the metrics and logs metrics created by Dev Box, see Monitoring Dev Box data reference.
For the detailed process for creating a diagnostic setting using the Azure portal, CLI, or PowerShell, see Create diagnostic setting to collect platform logs and metrics in Azure. When you create a diagnostic setting, you specify which categories of logs to collect. The categories for Dev box are listed in Microsoft Dev Box monitoring data reference.
Configure Azure diagnostic logs for a dev center
With Azure diagnostic logs for DevCenter, you can view audit logs for data plane operations in your dev center. The logs can be routed to an Azure Storage account or Log Analytics workspace. This feature is available on all dev centers.
Diagnostics logs allow you to export basic usage information from your dev center to different sources so that you can consume them in a customized way. The data plane audit logs expose information around CRUD operations for dev boxes within your dev center. Including, for example, start and stop commands executed on dev boxes. Some sample ways you can choose to export this data include:
- Export data to Blob storage
- Export data to CSV (comma separated value) format
- Export data to Azure Monitor logs and view and query data in your own Log Analytics workspace
To learn more about the different types of logs available for dev centers, see Monitor Dev Box data reference.
Enable logging with the Azure portal
Follow these steps to enable logging for your Azure DevCenter resource:
Sign in to the Azure portal.
In the Azure portal, navigate to your dev center.
In the Monitoring section, select Diagnostics settings.
Select Add diagnostic setting:
The Diagnostic Setting dialog opens:
Enable logging with Azure Storage
To use a storage account to store the logs, follow these steps.
Note
The following procedure requires an Azure Storage account in the same region as your dev center.
For the Diagnostic setting name field, enter a name for your diagnostic log settings.
Under Logs, select Dataplane audit logs.
Under Destination details, select Archive to a storage account.
Select the Subscription and Storage account for the logs.
Select Save.
Send to Log Analytics
To use Log Analytics for the logs, follow these steps:
Note
The following procedure requires a Log Analytics workspace.
For the Diagnostic setting name field, enter a name for your diagnostic log settings.
Under Logs, select Dataplane audit logs.
Under Destination details, select Send to Log Analytics workspace.
Select the Subscription and Log Analytics workspace for the logs.
Select Save.
Enable logging with PowerShell
The following example shows how to enable diagnostic logs by using Azure PowerShell Cmdlets.
Note
We recommend that you use the Azure Az PowerShell module to interact with Azure. To get started, see Install Azure PowerShell. To learn how to migrate to the Az PowerShell module, see Migrate Azure PowerShell from AzureRM to Az.
Enable diagnostic logs in a storage account
Sign in to Azure PowerShell:
Connect-AzAccount
Enable Diagnostic Logs in a Storage account by using the following commands. Replace the
<placeholder>
variables with your values:$rg = <your-resource-group-name> $devcenterid = <your-devcenter-ARM-resource-id> $storageacctid = <your-storage-account-resource-id> $diagname = <your-diagnostic-setting-name> $log = New-AzDiagnosticSettingLogSettingsObject -Enabled $true -Category DataplaneAuditEvent -RetentionPolicyDay 7 -RetentionPolicyEnabled $true New-AzDiagnosticSetting -Name $diagname -ResourceId $devcenterid -StorageAccountId $storageacctid -Log $log
Enable diagnostics logs for Log Analytics workspace
Sign in to Azure PowerShell:
Connect-AzAccount
Enable Diagnostic Logs for a Log Analytics workspace by using the following commands. Replace the
<placeholder>
variables with your values:$rg = <your-resource-group-name> $devcenterid = <your-devcenter-ARM-resource-id> $workspaceid = <your-log-analytics-workspace-resource-id> $diagname = <your-diagnostic-setting-name> $log = New-AzDiagnosticSettingLogSettingsObject -Enabled $true -Category DataplaneAuditEvent -RetentionPolicyDay 7 -RetentionPolicyEnabled $true New-AzDiagnosticSetting -Name $diagname -ResourceId $devcenterid -WorkspaceId $workspaceid -Log $log
Analyze diagnostic logs
This section describes existing tables for DevCenter diagnostic logs and how to query them.
All resource logs in Azure Monitor have the same fields followed by service-specific fields. The common schema is outlined in Common and service-specific schemas for Azure resource logs.
DevCenter stores data in the following tables:
Table | Description |
---|---|
DevCenterDiagnosticLogs | Stores data plane request/response information on dev box or environments within the dev center. |
DevCenterResourceOperationLogs | Contains operation logs pertaining to DevCenter resources, including information around resource health status changes. |
DevCenterBillingEventLogs | Lists billing event related to DevCenter resources. This log contains information about the quantity and unit charged per meter. |
Explore sample Kusto queries
After you enable diagnostic settings on your dev center, you should be able to view audit logs for the tables within a log analytics workspace.
Here are some queries you can enter into Log search to help your monitor your dev boxes.
To query for all data plane logs from DevCenter:
DevCenterDiagnosticLogs
To query for a filtered list of data plane logs, specific to a single devbox:
DevCenterDiagnosticLogs
| where TargetResourceId contains "<devbox-name>"
To generate a chart for data plane logs, grouped by operation result status:
DevCenterDiagnosticLogs
| summarize count() by OperationResult
| render piechart
These examples are just a small sample of the rich queries that can be performed in Monitor by using the Kusto Query Language. For more information, see Tutorial: Learn common operators.