Configuring Azure Virtual Machine to send application logs to a Log Analytics Workspace?

David Maryo 126 Reputation points
2024-12-13T16:05:05.0666667+00:00

We have set up a Log Analytics Workspace in Azure and are running an Azure Virtual Machine with "Windows Server 2022 Datacenter Azure Edition." One of our applications is hosted on this VM, and I would like to send its logs to the Log Analytics Workspace.

I believe this is achievable, but I’m not entirely sure about the exact steps required. Could someone please provide guidance or a step-by-step process for setting this up? Thank you in advance.

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,658 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ashok Gandhi Kotnana 10,350 Reputation points Microsoft External Staff Moderator
    2024-12-15T12:47:22.68+00:00

    Hi @David Maryo ,
    Welcome to Microsoft Q&A Forum, thank you for posting your query here!

    Please follow the below steps in order to send the Azure Virtual Machine application logs to a Log Analytics Workspace

    Step 1: Enable the Azure Monitor Agent

    Azure Monitor Agent (AMA) is the recommended agent for collecting data from Azure resources.

    In the Insights pane, choose the Log Analytics Workspace where you want to send the data and save the configuration, please find the screenshot below.

    a) Click on Enable

    User's image

    b) Create a new DCR (Data collection Rule) User's image

    c) Provide DCR and send the data to Log Analytics Workspace

    User's image

    This document has step by step procedure
    Refer: https://learn.microsoft.com/en-us/azure/azure-monitor/vm/tutorial-monitor-vm-enable-insights**

    Note: VM insights collects performance data from the VM guest operating system, but it doesn't collect log data such as Windows event log or Syslog. Now that you have the machine monitored with Azure Monitor Agent, you can create another data collection rule to perform this collection.

    Step 2: Configure Data Collection Rules (DCR)which data is collected and where it's sent.

    Step 2: Configure Data Collection Rules (DCR)

    Data Collection Rules (DCR) specify which data is collected and where it's sent.

    Create a DCR:

    • Create a DCR that sends guest performance data to Azure Monitor Metrics and log events to Azure Monitor Logs.
    • View guest logs in Log Analytics.
    • View guest metrics in metrics explorer.

    This document has step by step procedure

    Refer: https://learn.microsoft.com/en-us/azure/azure-monitor/vm/tutorial-monitor-vm-guest

    Please let us know if you have any further queries. I’m happy to assist you further.   

    User's image

    Please do not forget to "Accept the answer” wherever the information provided helps you, this can be beneficial to other community members.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.