Routing Logs to the Right Destination
This lesson explains how diagnostic settings and data collection rules deliver logs to their consumers.
Learning outcomes
After completing this lesson, you will be able to:
- Choose a log destination for a stated consumer.
- Describe diagnostic settings at resource, subscription and tenant levels.
- Explain how Azure Policy applies log routing at scale.
Diagnostic settings and their destinations
A diagnostic setting routes the resource logs and metrics of one Azure resource. Each destination has a distinct purpose, and a good design selects the destination according to how the data will be consumed.
Log Analytics workspace
This destination is chosen when the data will be queried, correlated with other data or used for alerts. Sending logs here enables KQL, workbooks, log alerts and Microsoft Sentinel. It is the default choice for operational and security logs.
Azure Storage account
A storage account is the low-cost destination for archiving logs. Data is written to blobs, where it can sit under lifecycle management rules and immutability policies. It is suitable when a regulation requires retention but the data will rarely be read. Querying it is inconvenient, because there is no KQL engine over the blobs.
Azure Event Hubs
An event hub streams logs to any consumer that reads from it, in near real time. This is the standard path to a third-party SIEM or log analytics platform running outside Azure. The event hub acts as a buffer, so the external system does not need a direct connection to each Azure resource.
Azure Monitor partner solutions
Certain partner products, such as Datadog and Elastic, are integrated directly as a destination. Partner solutions avoid the operation of an event hub when the organization already uses one of the supported products.
A single diagnostic setting can define no more than one of each destination type, and a resource can have up to five diagnostic settings. To send logs to the same type of destination twice, such as two workspaces, create a second diagnostic setting. The following table summarizes the destinations.
| Destination | Requirement it meets | Limitation |
|---|---|---|
| Log Analytics workspace | Query, correlate, alert, feed Microsoft Sentinel | Higher cost for high-volume data |
| Azure Storage account | Low-cost archive, immutable retention | No interactive query |
| Azure Event Hubs | Stream to an external SIEM or custom consumer | Not a long-term store |
| Partner solution | Direct integration with a supported product | Limited to listed partners |
The following diagram shows one diagnostic setting that routes the audit logs of 200 Azure SQL databases to three destinations.

Diagnostic setting destinations
Routing at the subscription and tenant levels
Diagnostic settings exist at more than the resource level, and a complete design covers all levels. A subscription diagnostic setting exports the activity log, so that control plane history survives beyond the 90 days held by the platform. Microsoft Entra diagnostic settings export sign-in and audit logs from the tenant, which matters because Entra keeps these logs for a limited period, shorter on free licences. These settings are configured in the Microsoft Entra admin center rather than on a resource.
Log routing should be enforced rather than left to individual deployments. Built-in Azure Policy definitions, usually with the deployIfNotExists effect, can create the diagnostic setting on any new resource of a given type and can remediate existing resources. Assigning such a policy at a management group means that new subscriptions inherit the logging standard automatically.
Routing beyond resources
Routing from inside machines
Data collected by the Azure Monitor Agent is routed by data collection rules rather than by diagnostic settings. A DCR can send security events to one workspace and performance counters to another, which is useful when a security team and an operations team have separate workspaces. This is known as multihoming, and the agent supports it without running multiple agents.
Servers outside Azure, whether on-premises or in another cloud, first become Azure Arc-enabled servers. They then appear as Azure resources and can receive the Azure Monitor Agent and data collection rules, so a single design covers Azure and hybrid machines.
Agent-based routing
Moving data after ingestion
Sometimes data must leave the workspace after it has been stored. Log Analytics workspace data export continuously sends selected tables to a storage account or event hub as data arrives. It suits integration with other systems and long-term data lake storage. Because the rule works on the tables rather than on individual resources, one rule can cover many sources.
Private access to monitoring is handled by an Azure Monitor Private Link Scope, which connects a virtual network to monitoring resources through private endpoints. It is the recommendation when agents or applications must reach Azure Monitor without traversing public endpoints. One scope covers a group of workspaces and Application Insights resources, and since it affects DNS for the whole network, Microsoft recommends a single scope per private network.
Routing to three consumers
A bank has 200 Azure SQL databases. Database audit logs must be available to its on-premises third-party SIEM within minutes, must be queryable by the Azure operations team, and must be retained unchanged for seven years at minimum cost. Every new database must be covered automatically. What should you recommend?
Three consumers lead to three destinations. The on-premises SIEM needs a stream, so one destination is an event hub. Operations needs KQL queries, so another is a Log Analytics workspace. Seven-year, tamper-proof retention at minimum cost points to a storage account with an immutability policy and a cool or archive tier.
All three can be defined in one diagnostic setting, because it uses one destination of each type. An Azure Policy assignment with deployIfNotExists covers new databases automatically. Long-term retention in the workspace could meet the seven-year requirement, but blob storage with a locked immutability policy provides explicit write-once protection at a lower cost, and a partner solution would not reach an on-premises product.
Can one diagnostic setting send logs to two different Log Analytics workspaces?
Show answer
No. A setting holds one destination of each type, so a second diagnostic setting is required. A resource can have up to five.
Exam Tips
Remember for the exam
- Workspace to query, storage to archive, event hub to stream to an external SIEM.
- One diagnostic setting holds one destination of each type; a resource has at most five settings.
- Export the activity log and Entra logs with their own diagnostic settings.
- Use Azure Policy with deployIfNotExists to apply diagnostic settings at scale.