Azure Log Analytics
This document provides an overview of Azure Log Analytics. In the Azure console, you can retrieve, inspect, and analyze log data using the Log Analytics services. Log Analytics provides a centralized location for log storage, analysis, and visualization, enabling you to monitor and troubleshoot your Azure environment effectively.
- You must have a valid Azure subscription to access and use Azure Log Analytics.
- You need to have an Azure Container Instances (ACI) or Azure Kubernetes Service (AKS) cluster where the CDC agent is deployed in a container. Ensure that the container is running and generating logs.
- Create an Azure Log Analytics workspace or ensure that you have an existing workspace.
- Enable container monitoring for the Azure Container Instances or Azure Kubernetes Service cluster where the CDC agent is deployed. This step ensures that the logs generated by the container are collected and forwarded to Azure Log Analytics.
To generate logs from Azure Log Analytics for a deployed CDC agent in an instance, you can follow these steps:
- Navigate to the Azure Portal. Enter your Azure account credentials to log in.
- Use the search bar at the top of the Azure Portal or navigate to the Log Analytics service from the services menu.
- In the Log Analytics dashboard, locate and click on the Log Analytics workspace associated with your CDC agent's logs. The workspace might have a name or pattern specific to your deployment.
- Once you are in the Log Analytics workspace, click Activity Log, where you can view logs generated by CDC agent. By default, you will see the Logs section where you can run queries and view log data.
- In the Logs section, you can write and execute queries using the Azure Monitor Query Language (KQL) to retrieve specific logs. You can filter logs based on time range, specific instance, or other relevant parameters.
- Queries example:
// Retrieve logs with specific table ContainerInstanceLog_CL | project TimeGenerated, Message
Messageare fields from the
ContainerInstanceLog_CLtable. This query will retrieve the
timestamp(TimeGenerated) and the
log message(Message) from the logs generated by container instances.
- Use the query results to analyze the logs generated by your CDC agent. You can identify patterns, troubleshoot issues, and gain insights into the behavior of your deployment.
- Azure Log Analytics also allows you to create custom dashboards and set up alerts based on log data. These features can help you monitor and receive notifications for specific events or log conditions.