Azure Storage Metrics Tutorials

Learn how to monitor and analyze your Azure Storage performance and usage.

Get Started with Azure Storage Metrics

This tutorial will guide you through the process of enabling, viewing, and interpreting metrics for your Azure Storage accounts. Understanding your storage metrics is crucial for optimizing performance, managing costs, and ensuring the availability of your applications.

Prerequisites

Tutorial Steps

  1. Enable Diagnostic Settings

    Azure Storage metrics are collected through diagnostic settings. You can configure these settings to send metrics to Azure Monitor Logs (Log Analytics), Event Hubs, or a storage account for archival.

    Steps:

    1. Navigate to your Azure Storage account in the Azure portal.
    2. In the left-hand menu, under Monitoring, select Diagnostic settings.
    3. Click + Add diagnostic setting.
    4. Give your setting a name (e.g., StorageMetricsLogs).
    5. Under Logs, select the categories you want to collect. For metrics, focus on categories like Transaction, StorageRead, and StorageWrite.
    6. Under Metrics, select AllMetrics to collect all available metrics.
    7. Under Destination details, choose where you want to send your logs and metrics. For this tutorial, we'll focus on sending to Log Analytics workspace. Select your subscription and workspace.
    8. Click Save.
  2. View Metrics in Azure Monitor

    Once diagnostic settings are configured, your metrics will start flowing into Azure Monitor. You can view these metrics in the Metrics explorer.

    Steps:

    1. Navigate back to your Azure Storage account.
    2. In the left-hand menu, under Monitoring, select Metrics.
    3. The Metrics explorer will open. You can select the Namespace (e.g., Microsoft.Storage/storageAccounts) and then choose the desired Metric from the dropdown.
    4. Common metrics include:
      • Transactions: Number of successful storage requests.
      • Ingress / Egress: Amount of data written to/read from storage.
      • Availability: Percentage of time the storage service is available.
      • Latency (Average, Success Server Latency): Average time taken to process a request.
    5. Use the Split by, Filter, and Aggregation options to customize your view. For example, you can split by API name to see transaction counts per API operation.
  3. Analyze Metrics with Log Analytics (Optional but Recommended)

    For more in-depth analysis, querying your storage logs and metrics in Log Analytics provides powerful capabilities.

    Steps:

    1. Navigate to your Log Analytics workspace that you configured in Step 1.
    2. Select Logs from the left-hand menu.
    3. Use Kusto Query Language (KQL) to query your storage data. The table name for storage logs is typically StorageBlobLogs, StorageFileLogs, etc., or you can use a general table like StorageBlobInventoryLogs for blob metadata. Metrics are often stored in tables like AzureMetrics.
    4. Here are a few example queries:
      Example: Blob Transaction Count by API
      StorageBlobLogs
      | where TimeGenerated > ago(1d)
      | summarize count() by APIName
      | order by count_ desc
      Example: Average Latency for Read Operations
      StorageBlobLogs
      | where TimeGenerated > ago(1d) and OperationName == "GetBlob"
      | extend ServerLatencyMs = todouble(ServerLatencyMs)
      | summarize avg(ServerLatencyMs) by bin(TimeGenerated, 5m)
      | render timechart
      Example: Ingress and Egress over the last 24 hours
      AzureMetrics
      | where ResourceProvider == "MICROSOFT.STORAGE" and ResourceKind == "AZURESTORAGE"
      | where MetricName == "Ingress" or MetricName == "Egress"
      | summarize Value = sum(SampledValue) by bin(TimeGenerated, 1h), MetricName
      | render timechart
    5. Click Run query to see the results. You can then visualize these results as charts or tables.
  4. Set Up Alerts

    Proactive monitoring is key. Set up alerts in Azure Monitor to be notified when certain metric thresholds are breached.

    Steps:

    1. Navigate to your Azure Storage account.
    2. In the left-hand menu, under Monitoring, select Alerts.
    3. Click + Create > Alert rule.
    4. Under Scope, ensure your storage account is selected.
    5. Under Condition, click Add condition.
    6. Select the Signal name (e.g., Transactions, Availability, Egress).
    7. Configure the Logic (e.g., Threshold type: Static, Operator: Greater than, Threshold value: 100000 for transactions per hour).
    8. Set the Evaluation frequency and Lookback period.
    9. Under Actions, click Select action group or Create action group to define how you want to be notified (e.g., email, SMS, webhook).
    10. Provide a Severity, Alert rule name, and Description.
    11. Click Review + create, then Create.

Note

The exact names of logs and metrics might vary slightly based on the Azure Storage service (Blob, File, Queue, Table) and any updates to Azure. Always refer to the official Azure documentation for the most up-to-date information.

Tip

Consider creating dashboards in Azure Monitor that combine key storage metrics and Log Analytics queries for a consolidated view of your storage performance and health.

Next Steps