Azure Monitor: metrics, logs and insights

AZ-104 Azure AdministratorMonitor and maintainAbout 20 minutesBy Cloud Hands On

Understand what Azure collects automatically, what you must switch on, and where each kind of data goes.

In this lesson you'll learn

1. Two kinds of data

New to monitoring? Start here

Monitoring answers three questions: Is it healthy? What happened? Who changed it? Azure Monitor is the single service that collects the data to answer all three, for everything in Azure and for servers elsewhere.

Sources send data to metrics and logs, which feed charts, queries, alerts and workbooks Azure resources VM guest OS Subscription Applications MetricsNumbers over time LogsRecords, queried in KQL Metrics Explorer Log Analytics Alerts Workbooks, Insights Logs live in a Log Analytics workspace
Platform metrics arrive automatically. Most logs only arrive once you switch them on.
ItemMetricsLogs
ShapeNumbers at regular intervals (CPU %, requests)Records with many fields (events, errors, sign-ins)
SpeedNear real timeA few minutes delay
Kept93 daysSet per workspace, up to 12 years in total
Explore withMetrics ExplorerKQL in Log Analytics

2. The activity log

The activity log records control plane events across the subscription: who created, changed, deleted, started or deallocated what, and when. It also shows Service Health events. It is kept for 90 days. Send it to a workspace to keep it longer or query it with KQL.

Exam focus

"Notify me when a VM is deallocated" or "who deleted this resource" means the activity log. Metrics cannot tell you who did something.

3. Diagnostic settings

Resource logs, such as Key Vault access logs or storage read requests, are not collected until you add a diagnostic setting on the resource.

DestinationUse it to
Log Analytics workspaceQuery with KQL and alert on logs
Storage accountArchive cheaply for audits
Event HubsStream to a SIEM or third-party tool
Partner solutionSend to supported monitoring partners

4. Monitoring inside VMs

Azure sees a VM's host metrics, like CPU, but not what happens inside the operating system. For guest event logs, syslog and performance counters:

  1. Create a Log Analytics workspace.
  2. Create a data collection rule (DCR) that says what to collect (for example System and Application errors) and where to send it.
  3. The Azure Monitor Agent is installed on each VM associated with the rule. One agent can send to several workspaces.

Insights are ready-made monitoring views: VM Insights (performance and a dependency map), Storage Insights, Network Insights and Container Insights.

Example

SS Kaiser's app server keeps freezing at night, but CPU metrics look normal. The team creates a DCR that collects Application event log errors from the VM into their workspace. The next morning, a KQL query shows a disk-full error from the backup software at 2 am every night.

Exam traps to remember

  • The legacy Log Analytics agent (MMA) is retired. Use Azure Monitor Agent.
  • Resource logs need a diagnostic setting. Platform metrics do not.
  • Guest OS events need a workspace and DCR. They are not VM metrics.

Test yourself: 3 check questions and exam-style practice questions on this topic are in the AZ-104 Azure Administrator app.

Practise in the app

Keep going