Azure Monitor & Log Analytics

Azure Monitor & Log Analytics project cover
Project CategoryCloud Monitoring
PlatformMicrosoft Azure
Core TechnologiesAzure Monitor, Log Analytics, KQL, Alerts
Project FocusCentralized monitoring, log analysis, and alerting

Project Overview

Implemented centralized monitoring for an Azure virtual machine using Azure Monitor, Log Analytics, the Azure Monitor Agent, Data Collection Rules, KQL queries, and alert notifications.

1. Business Scenario

The environment required a central view of health and performance instead of checking each resource manually. Logs, metrics, and alerts were consolidated so operational issues could be detected and investigated quickly.

2. Project Objectives

3. Azure Resources Created

Resource Type Resource Name
Resource Group vm-monitor-01_group
Virtual Machine vm-monitor-01
Virtual Network vnet-eastus2-1
Network Security Group vm-monitor-01-nsg
Network Interface vm-monitor-01482
Public IP Address vm-monitor-01-ip
Azure Monitor Agent Azure Monitor Agent (AMA)
Data Collection Rule dcr-monitor-01
Log Analytics Workspace law-monitor-01
Alert Rule High-CPU-Alert
Action Group VMI-ActionGroup-vm-monitor-01

4. Solution Architecture

Azure Monitor and Log Analytics architecture diagram

5. Implementation

5.1 Deploy Ubuntu Virtual Machine

A Linux virtual machine running Ubuntu Server was deployed in Microsoft Azure and configured for secure remote administration using SSH.

Azure Monitor & Log Analytics project screenshot

Deployment of vm-monitor-01 completed successfully inside vm-monitor-01_group.

Azure Monitor & Log Analytics project screenshot

Secure SSH connection established to the Ubuntu virtual machine.

5.2 Configure Azure Monitor

Azure Monitor was enabled to provide infrastructure monitoring for the virtual machine.

VM Insights was configured to monitor:

Azure Monitor & Log Analytics project screenshot

Azure Monitor blade for vm-monitor-01 after enabling monitoring.

5.3 Install Azure Monitor Agent

Azure Monitor Agent (AMA) was installed on the Ubuntu virtual machine.

The agent continuously collects system performance metrics and operational telemetry from the operating system.

5.4 Configure Data Collection Rule

A Data Collection Rule (DCR) was configured to define which monitoring data should be collected.

Collected telemetry included:

Azure Monitor & Log Analytics project screenshot

Scoping the Data Collection Rule to vm-monitor-01 within vm-monitor-01_group.

Azure Monitor & Log Analytics project screenshot

Selecting performance counter categories: CPU, Disk, Network and Process.

Azure Monitor & Log Analytics project screenshot

CPU counter — Processor Time sampled every 60 seconds.

Azure Monitor & Log Analytics project screenshot

Memory counters — Available MBytes and % Available Memory.

Azure Monitor & Log Analytics project screenshot

Logical Disk counter — % Free Space.

Azure Monitor & Log Analytics project screenshot

Disk Reads/Writes per second and Network Interface counters.

Azure Monitor & Log Analytics project screenshot

Review + create summary for Data Collection Rule dcr-monitor-01.

Azure Monitor & Log Analytics project screenshot

Data Collection Rule deployment completed successfully.

5.5 Configure Log Analytics Workspace

The virtual machine was connected to Log Analytics Workspace to enable centralized storage, querying, and analysis of monitoring data.

Azure Monitor & Log Analytics project screenshot

Data Collection Rule destination configured to Log Analytics Workspace law-monitor-01.

5.6 Monitor Virtual Machine Performance

Real-time monitoring was successfully enabled for:

Performance data was continuously collected and displayed within Azure Monitor.

Azure Monitor & Log Analytics project screenshot

VM availability and CPU utilization metrics.

Azure Monitor & Log Analytics project screenshot

Memory utilization percentage over time.

Azure Monitor & Log Analytics project screenshot

Top 5 processes by memory utilization.

Azure Monitor & Log Analytics project screenshot

Network traffic, dropped packets, and network errors.

Azure Monitor & Log Analytics project screenshot

Logical disk usage and disk IOPS.

Azure Monitor & Log Analytics project screenshot

Logical disk latency (ms).

Azure Monitor & Log Analytics project screenshot

Logical disk throughput and top 5 processes by disk write operations.

6. Kusto Query Language (KQL)

Monitoring data was analyzed using Kusto Query Language (KQL).

6.1 Heartbeat Monitoring

Heartbeat
| where Computer == "vm-monitor-01"
| sort by TimeGenerated desc

This query verifies that the virtual machine continuously reports its operational status.

Azure Monitor & Log Analytics project screenshot

Heartbeat query results confirming continuous agent reporting.

6.2 CPU Utilization

InsightsMetrics
| where TimeGenerated > ago(30m)
| where Namespace == "Processor"
| where Name == "UtilizationPercentage"
| summarize AvgCPU = avg(Val) by bin(TimeGenerated, 1m)
| render timechart

This query visualizes processor utilization over time.

Azure Monitor & Log Analytics project screenshot

Confirming the UtilizationPercentage metric exists under the Processor namespace.

Azure Monitor & Log Analytics project screenshot

CPU utilization time chart generated from the KQL query.

Azure Monitor & Log Analytics project screenshot

Query saved as a chart inside an Azure Monitor Workbook for dashboarding.

6.3 Memory Performance

Perf
| where TimeGenerated > ago(30m)
| where ObjectName == "Memory"
| summarize AvgMemory = avg(CounterValue) by bin(TimeGenerated, 1m)
| render timechart

This chart displays memory performance collected from the Ubuntu virtual machine.

6.4 Disk Read Performance

Perf
| where TimeGenerated > ago(30m)
| where ObjectName == "Logical Disk"
| where CounterName == "Disk Reads/sec"
| summarize AvgReads = avg(CounterValue) by bin(TimeGenerated, 1m)
| render timechart

This chart visualizes disk read operations over time.

6.5 Disk Write Performance

Perf
| where TimeGenerated > ago(30m)
| where ObjectName == "Logical Disk"
| where CounterName == "Disk Writes/sec"
| summarize AvgDiskWrites = avg(CounterValue) by bin(TimeGenerated, 1m)
| render timechart

This chart visualizes disk write operations over time.

Azure Monitor & Log Analytics project screenshot

Disk write operations query saved as a Workbook chart ("Disk Write Operations").

7. Alert Configuration

An Azure Monitor alert rule was configured to detect abnormal CPU utilization.

Alert Configuration:

Whenever CPU utilization exceeded the configured threshold, Azure Monitor automatically triggered the alert.

Azure Monitor & Log Analytics project screenshot

Defining the alert condition: Percentage CPU greater than 60%.

Azure Monitor & Log Analytics project screenshot

Alert rule details — High-CPU-Alert, severity Warning.

Azure Monitor & Log Analytics project screenshot

Review + create summary for the High-CPU-Alert rule.

Azure Monitor & Log Analytics project screenshot

Alert rule enabled and active on vm-monitor-01.

8. Action Group

An Azure Action Group was configured to send email notifications whenever the alert rule was triggered.

This provides immediate notification to administrators during high CPU utilization events.

Azure Monitor & Log Analytics project screenshot

Action group VMI-ActionGroup-vm-monitor-01 configured with an email action.

9. Alert Validation

CPU load was intentionally generated on the Ubuntu virtual machine using:

stress-ng --cpu 2 --timeout 10m

Azure Monitor & Log Analytics project screenshot

Installing and running stress-ng to generate CPU load on the Ubuntu VM.

Azure Monitor & Log Analytics project screenshot

Metrics Explorer confirming the CPU spike to over 99% during the stress test.

Azure Monitor successfully:

Azure Monitor & Log Analytics project screenshot

Alert fired: High-CPU-Alert email notification received.

Azure Monitor & Log Analytics project screenshot

Alert resolved: High-CPU-Alert email notification once CPU returned to normal.

This confirmed that the complete monitoring pipeline was functioning correctly.

10. Results

The monitoring solution successfully provided: