Part 4: Querying Azure Log Analytics Workspace

Understanding Azure Resource Logs

In my experience managing Azure infrastructure, understanding the various log types and table schemas is essential for effective troubleshooting and monitoring. In this part, I'll share what I've learned about querying specific Azure resources.

Common Log Analytics Tables

Let me walk you through the tables I query most frequently and what they contain.

AzureActivity - Control Plane Operations

This table contains Azure Resource Manager operations - essentially a record of who did what in your Azure subscription.

Schema Overview:

AzureActivity
| getschema
| project ColumnName, ColumnType

Useful queries I run daily:

// Track resource deployments
AzureActivity
| where TimeGenerated > ago(24h)
| where OperationNameValue contains "write"
| where ActivityStatusValue == "Success"
| project 
    TimeGenerated,
    Caller,
    OperationNameValue,
    ResourceGroup,
    Resource,
    Level
| order by TimeGenerated desc

// Find failed operations
AzureActivity
| where TimeGenerated > ago(24h)
| where ActivityStatusValue in ("Failed", "Error")
| summarize 
    FailureCount = count(),
    SampleError = any(ActivityStatusValue),
    LastFailure = max(TimeGenerated)
    by Caller, OperationNameValue, ResourceGroup
| order by FailureCount desc

// Who deleted resources?
AzureActivity
| where TimeGenerated > ago(7d)
| where OperationNameValue contains "delete"
| project TimeGenerated, Caller, Resource, ResourceGroup, OperationNameValue
| order by TimeGenerated desc

AzureDiagnostics - Data Plane Logs

AzureDiagnostics contains diagnostic logs from various Azure services. The schema varies by ResourceType and Category.

Key pattern I use - always filter by ResourceType:

Heartbeat - Agent Health and Inventory

Tracks health and inventory of machines with Log Analytics agent installed.

My standard health checks:

Perf - Performance Counters

Contains performance metrics from Windows and Linux machines.

CPU monitoring queries I use:

Memory monitoring:

Disk performance:

Syslog - Linux System Logs

For Linux machines, system logs appear in the Syslog table.

Event - Windows Event Logs

Windows event logs for Application, System, and Security logs.

Container and Kubernetes Monitoring

For AKS and container workloads, these tables are essential.

ContainerLog - Container stdout/stderr

KubePodInventory - Pod Metadata

KubeEvents - Kubernetes Events

Perf - Container Performance

Application Insights Tables

For application monitoring, Application Insights provides rich telemetry.

AppRequests - HTTP Requests

AppExceptions - Application Exceptions

AppDependencies - External Dependencies

Resource-Specific Query Patterns

Azure Storage Account Monitoring

Azure SQL Database

Azure Functions

Cross-Resource Correlation

One of my most valuable patterns is correlating issues across different resource types:

Practical Monitoring Scenarios

Scenario 1: Complete Application Health Check

Scenario 2: Infrastructure Capacity Planning

Key Takeaways

  • Always filter by ResourceType and Category in AzureDiagnostics

  • Use Heartbeat for agent inventory and health tracking

  • Perf provides critical performance metrics across platforms

  • Container tables (ContainerLog, KubePodInventory, KubeEvents) are essential for Kubernetes

  • Application Insights tables provide full application telemetry

  • Cross-resource correlation reveals relationship between infrastructure and application issues

  • Understanding table schemas is crucial for effective queries

In Part 5, we'll use these querying skills to build comprehensive observability dashboards with Azure Workbooks and create visualizations that provide actionable insights.

Last updated