Designing logging and monitoring
Choose where logs go, how many Log Analytics workspaces you need, and which monitoring tool answers each question.
In this lesson you'll learn
- The kinds of monitoring data Azure produces, and where each one lives
- How to route logs with diagnostic settings and data collection rules
- How many Log Analytics workspaces to create, and why
- Matching tools to needs: Azure Monitor, Application Insights, Network Watcher, Sentinel
1. What you're designing
Refresher: Azure monitoring data
Metrics are numbers sampled over time, such as CPU percentage, kept for 93 days. Logs are records with many fields, queried with KQL in a Log Analytics workspace. The activity log records management actions on your subscription, such as who deleted a VM.
An architect's job isn't to click through the portal. It's to answer three design questions for the whole estate:
- Logging: which data must be collected, and how long it must be kept.
- Routing: where each type of data goes: a workspace for queries, storage for cheap archiving, or Event Hubs for other tools.
- Monitoring: which tool watches what, and who gets alerted.
2. Routing logs
| Requirement | Route to |
|---|---|
| Query, correlate and alert on logs | Log Analytics workspace |
| Keep logs for years at the lowest cost, rarely read | Storage account (or workspace long-term retention) |
| Send logs to a third-party SIEM or custom app in near real time | Event Hubs |
| Collect Windows events or Linux syslog from VMs | Azure Monitor Agent with a data collection rule |
3. How many workspaces?
Microsoft's guidance is to start with one workspace and only add more when there's a clear reason. Fewer workspaces make cross-resource queries and administration easier.
| Reason to add a workspace | Why |
|---|---|
| Data must stay in a specific geography | A workspace stores data in its own region |
| Different tenants or legal entities | Strong separation of data and billing |
| Very different retention or cost needs | Retention is set per workspace and table |
4. Choosing a monitoring tool
| Question | Tool |
|---|---|
| Is my web app slow, and which dependency is failing? | Application Insights |
| How are my VMs performing, and what do they connect to? | VM insights |
| Why can't VM1 reach VM2? | Network Watcher |
| Is an Azure outage affecting my region? | Service Health |
| Detect and respond to security threats across the estate | Microsoft Sentinel |
| Combine metrics, logs and text into an interactive report | Azure Monitor workbooks |
Example
Larkfield Group runs 300 VMs in two regions. The security team uses Splunk. The architect recommends one Log Analytics workspace per region, because data must stay in each country. Azure Monitor Agent with data collection rules collects guest logs. Diagnostic settings send Key Vault and firewall logs to both the workspace and an Event Hub for Splunk, and an archive copy in storage meets the seven-year audit retention.
Exam traps to remember
- Event Hubs is the answer when logs must reach an external tool. Storage is for archiving, not streaming.
- Don't create a workspace per team just for permissions. Use resource-context or table-level access.
- Guest OS data needs the Azure Monitor Agent. Diagnostic settings only cover platform data.
- The activity log is kept for 90 days. Route it to a workspace or storage to keep it longer.
Test yourself: 3 check questions and exam-style practice questions on this topic are in the AZ-305 Azure Solutions Architect app.
Practise in the app