Monitoring Azure Files
When you have critical applications and business processes that rely on Azure resources, you want to monitor those resources for their availability, performance, and operation. This article describes the monitoring data that's generated by Azure Files and how you can use the features of Azure Monitor to analyze alerts on this data.
Applies to
File share type | SMB | NFS |
---|---|---|
Standard file shares (GPv2), LRS/ZRS | ![]() |
![]() |
Standard file shares (GPv2), GRS/GZRS | ![]() |
![]() |
Premium file shares (FileStorage), LRS/ZRS | ![]() |
![]() |
Monitor overview
The Overview page in the Azure portal for each Azure Files resource includes a brief view of the resource usage, such as requests and hourly billing. This information is useful, but only a small amount of the monitoring data is available. Some of this data is collected automatically and is available for analysis as soon as you create the resource. You can enable additional types of data collection with some configuration.
What is Azure Monitor?
Azure Files creates monitoring data by using Azure Monitor, which is a full stack monitoring service in Azure. Azure Monitor provides a complete set of features to monitor your Azure resources and resources in other clouds and on-premises.
Start with the article Monitoring Azure resources with Azure Monitor, which describes the following:
- What is Azure Monitor?
- Costs associated with monitoring
- Monitoring data collected in Azure
- Configuring data collection
- Standard tools in Azure for analyzing and alerting on monitoring data
The following sections build on this article by describing the specific data gathered from Azure Files. Examples show how to configure data collection and analyze this data with Azure tools.
Monitoring data
Azure Files collects the same kinds of monitoring data as other Azure resources, which are described in Monitoring data from Azure resources.
See Azure File monitoring data reference for detailed information on the metrics and logs metrics created by Azure Files.
Metrics and logs in Azure Monitor support only Azure Resource Manager storage accounts. Azure Monitor doesn't support classic storage accounts. If you want to use metrics or logs on a classic storage account, you need to migrate to an Azure Resource Manager storage account. See Migrate to Azure Resource Manager.
Collection and routing
Platform metrics and the Activity log are collected automatically, but can be routed to other locations by using a diagnostic setting.
To collect resource logs, you must create a diagnostic setting. When you create the setting, choose file as the type of storage that you want to enable logs for. Then, specify one of the following categories of operations for which you want to collect logs.
Category | Description |
---|---|
StorageRead | Read operations on objects. |
StorageWrite | Write operations on objects. |
StorageDelete | Delete operations on objects. |
To get the list of SMB and REST operations that are logged, see Storage logged operations and status messages and Azure Files monitoring data reference.
See Create diagnostic setting to collect platform logs and metrics in Azure for the detailed process for creating a diagnostic setting using the Azure portal, CLI, and PowerShell. You can also find links to information about how to create a diagnostic setting by using an Azure Resource Manager template or an Azure Policy definition.
Destination limitations
For general destination limitations, see Destination limitations. The following limitations apply only to monitoring Azure Storage accounts.
You can't send logs to the same storage account that you're monitoring with this setting.
This would lead to recursive logs in which a log entry describes the writing of another log entry. You must create an account or use another existing account to store log information.
You can't set a retention policy.
If you archive logs to a storage account, you can manage the retention policy of a log container by defining a lifecycle management policy. To learn how, see Optimize costs by automating Azure Blob Storage access tiers.
If you send logs to Log Analytics, you can manage the data retention period of Log Analytics at the workspace level or even specify different retention settings by data type. To learn how, see Change the data retention period.
Analyzing metrics
For a list of all Azure Monitor support metrics, which includes Azure Files, see Azure Monitor supported metrics.
You can analyze metrics for Azure Storage with metrics from other Azure services by using Metrics Explorer. Open Metrics Explorer by choosing Metrics from the Azure Monitor menu. For details on using this tool, see Getting started with Azure Metrics Explorer.
For metrics that support dimensions, you can filter the metric with the desired dimension value. For a complete list of the dimensions that Azure Storage supports, see Metrics dimensions. Metrics for Azure Files are in these namespaces:
- Microsoft.Storage/storageAccounts
- Microsoft.Storage/storageAccounts/fileServices
Analyzing logs
You can access resource logs either as a blob in a storage account, as event data, or through Log Analytic queries. For information about how to find those logs, see Azure resource logs.
All resource logs in Azure Monitor have the same fields followed by service-specific fields. The common schema is outlined in Azure Monitor resource log schema. The schema for Azure Files resource logs is found in Azure Files monitoring data reference.
To get the list of SMB and REST operations that are logged, see Storage logged operations and status messages.
Log entries are created only if there are requests made against the service endpoint. For example, if a storage account has activity in its file endpoint but not in its table or queue endpoints, only logs that pertain to the Azure File service are created. Azure Storage logs contain detailed information about successful and failed requests to a storage service. This information can be used to monitor individual requests and to diagnose issues with a storage service. Requests are logged on a best-effort basis.
The Activity log is a type of platform log located in Azure that provides insight into subscription-level events. You can view it independently or route it to Azure Monitor Logs, where you can do much more complex queries using Log Analytics.
Log authenticated requests
The following types of authenticated requests are logged:
- Successful requests
- Failed requests, including timeout, throttling, network, authorization, and other errors
- Requests that use Kerberos, NTLM or shared access signature (SAS), including failed and successful requests
- Requests to analytics data (classic log data in the $logs container and classic metric data in the $metric tables)
Requests made by the Azure Files service itself, such as log creation or deletion, aren't logged. For a full list of the SMB and REST requests that are logged, see Storage logged operations and status messages and Azure Files monitoring data reference.
Sample Kusto queries
If you send logs to Log Analytics, you can access those logs by using Azure Monitor log queries. For more information, see Log Analytics tutorial.
Here are some queries that you can enter in the Log search bar to help you monitor your Azure Files. These queries work with the new language.
Important
When you select Logs from the storage account resource group menu, Log Analytics is opened with the query scope set to the current resource group. This means that log queries will only include data from that resource group. If you want to run a query that includes data from other resources or data from other Azure services, select Logs from the Azure Monitor menu. See Log query scope and time range in Azure Monitor Log Analytics for details.
Use these queries to help you monitor your Azure file shares:
- View SMB errors over the last week
StorageFileLogs
| where Protocol == "SMB" and TimeGenerated >= ago(7d) and StatusCode contains "-"
| sort by StatusCode
- Create a pie chart of SMB operations over the last week
StorageFileLogs
| where Protocol == "SMB" and TimeGenerated >= ago(7d)
| summarize count() by OperationName
| sort by count_ desc
| render piechart
- View REST errors over the last week
StorageFileLogs
| where Protocol == "HTTPS" and TimeGenerated >= ago(7d) and StatusText !contains "Success"
| sort by StatusText asc
- Create a pie chart of REST operations over the last week
StorageFileLogs
| where Protocol == "HTTPS" and TimeGenerated >= ago(7d)
| summarize count() by OperationName
| sort by count_ desc
| render piechart
To view the list of column names and descriptions for Azure Files, see StorageFileLogs.
For more information on how to write queries, see Log Analytics tutorial.
Alerts
Azure Monitor alerts proactively notify you when important conditions are found in your monitoring data. They allow you to identify and address issues in your system before your customers notice them. You can set alerts on metrics, logs, and the activity log.
The following table lists some example scenarios to monitor and the proper metric to use for the alert:
Scenario | Metric to use for alert |
---|---|
File share is throttled. | Metric: Transactions Dimension name: Response type Dimension name: FileShare (premium file share only) |
File share size is 80% of capacity. | Metric: File Capacity Dimension name: FileShare (premium file share only) |
File share egress has exceeded 500 GiB in one day. | Metric: Egress Dimension name: FileShare (premium file share only) |
How to create alerts for Azure Files
Go to your storage account in the Azure portal.
Click Alerts and then click + New alert rule.
Click Edit resource, select the File resource type and then click Done.
Click Add condition and provide the following information for the alert:
- Metric
- Dimension name
- Alert logic
Click Add action groups and add an action group (email, SMS, etc.) to the alert either by selecting an existing action group or creating a new action group.
Fill in the Alert details like Alert rule name, Description, and Severity.
Click Create alert rule to create the alert.
Note
If you create an alert and it's too noisy, adjust the threshold value and alert logic.
How to create an alert if a file share is throttled
Go to your storage account in the Azure portal.
In the Monitoring section, click Alerts, and then click + New alert rule.
Click Edit resource, select the File resource type for the storage account and then click Done. For example, if the storage account name is
contoso
, select thecontoso/file
resource.Click Add condition to add a condition.
You'll see a list of signals supported for the storage account, select the Transactions metric.
On the Configure signal logic blade, click the Dimension name drop-down and select Response type.
Click the Dimension values drop-down and select the appropriate response types for your file share.
For standard file shares, select the following response types:
- SuccessWithShareIopsThrottling
- SuccessWithThrottling
- ClientShareIopsThrottlingError
For premium file shares, select the following response types:
- SuccessWithShareEgressThrottling
- SuccessWithShareIngressThrottling
- SuccessWithShareIopsThrottling
- ClientShareEgressThrottlingError
- ClientShareIngressThrottlingError
- ClientShareIopsThrottlingError
Note
If the response types are not listed in the Dimension values drop-down, this means the resource has not been throttled. To add the dimension values, next to the Dimension values drop-down list, select Add custom value, enter the respone type (for example, SuccessWithThrottling), select OK, and then repeat these steps to add all applicable response types for your file share.
For premium file shares, click the Dimension name drop-down and select File Share. For standard file shares, skip to step #10.
Note
If the file share is a standard file share, the File Share dimension will not list the file share(s) because per-share metrics are not available for standard file shares. Throttling alerts for standard file shares will be triggered if any file share within the storage account is throttled and the alert will not identify which file share was throttled. Since per-share metrics are not available for standard file shares, the recommendation is to have one file share per storage account.
Click the Dimension values drop-down and select the file share(s) that you want to alert on.
Define the alert parameters (threshold value, operator, aggregation granularity and frequency of evaluation) and click Done.
Tip
If you are using a static threshold, the metric chart can help determine a reasonable threshold value if the file share is currently being throttled. If you're using a dynamic threshold, the metric chart will display the calculated thresholds based on recent data.
Click Add action groups to add an action group (email, SMS, etc.) to the alert either by selecting an existing action group or creating a new action group.
Fill in the Alert details like Alert rule name, Description, and Severity.
Click Create alert rule to create the alert.
How to create an alert if the Azure file share size is 80% of capacity
Go to your storage account in the Azure portal.
In the Monitoring section, click Alerts and then click + New alert rule.
Click Edit resource, select the File resource type for the storage account and then click Done. For example, if the storage account name is
contoso
, select thecontoso/file
resource.Click Add condition to add a condition.
You'll see a list of signals supported for the storage account, select the File Capacity metric.
For premium file shares, click the Dimension name drop-down and select File Share. For standard file shares, skip to step #8.
Note
If the file share is a standard file share, the File Share dimension will not list the file share(s) because per-share metrics are not available for standard file shares. Alerts for standard file shares are based on all file shares in the storage account. Since per-share metrics are not available for standard file shares, the recommendation is to have one file share per storage account.
Click the Dimension values drop-down and select the file share(s) that you want to alert on.
Enter the Threshold value in bytes. For example, if the file share size is 100 TiB and you want to receive an alert when the file share size is 80% of capacity, the threshold value in bytes is 87960930222080.
Define the rest of the alert parameters (aggregation granularity and frequency of evaluation) and click Done.
Click Add action groups to add an action group (email, SMS, etc.) to the alert either by selecting an existing action group or creating a new action group.
Fill in the Alert details like Alert rule name, Description, and Severity.
Click Create alert rule to create the alert.
How to create an alert if the Azure file share egress has exceeded 500 GiB in a day
Go to your storage account in the Azure portal.
In the Monitoring section, click Alerts and then click + New alert rule.
Click Edit resource, select the File resource type for the storage account and then click Done. For example, if the storage account name is contoso, select the contoso/file resource.
Click Add condition to add a condition.
You'll see a list of signals supported for the storage account, select the Egress metric.
For premium file shares, click the Dimension name drop-down and select File Share. For standard file shares, skip to step #8.
Note
If the file share is a standard file share, the File Share dimension will not list the file share(s) because per-share metrics are not available for standard file shares. Alerts for standard file shares are based on all file shares in the storage account. Since per-share metrics are not available for standard file shares, the recommendation is to have one file share per storage account.
Click the Dimension values drop-down and select the file share(s) that you want to alert on.
Enter 536870912000 bytes for Threshold value.
Click the Aggregation granularity drop-down and select 24 hours.
Select the Frequency of evaluation and click Done.
Click Add action groups to add an action group (email, SMS, etc.) to the alert either by selecting an existing action group or creating a new action group.
Fill in the Alert details like Alert rule name, Description, and Severity.
Click Create alert rule to create the alert.
Next steps
Feedback
Submit and view feedback for