CloudGuild · Blog · Cheat sheets · Lessons · Certifications
Understanding Azure Monitor Log Collection
Learn how to manage log collection for Azure resources effectively. We break down a common exam question to help you prepare for the AZ-104.
You may have encountered questions around Azure Monitor and log management in your exam prep. One specific decision that can trip candidates is how to ensure only certain Azure resources send their logs to a designated Log Analytics workspace. This question requires clarity about resource configurations and log settings.
The question
You have configured Azure Monitor to collect logs from your resources. You need to ensure that only certain Azure resources send their logs to a specific Log Analytics workspace. How can you achieve this?
- A. By configuring the diagnostic settings of each resource
- B. By linking the resources to the workspace directly
- C. By using Azure Policy to enforce log collection
- D. By creating a custom script to manage log settings
Think before you scroll
When considering your options, focus on how Azure Monitor handles log collection. The correct choice will directly address the need to configure log settings at the resource level. Avoid options that suggest broad compliance measures or less efficient methods.
The answer
The correct option is A: By configuring the diagnostic settings of each resource. This method allows you to specify which logs from each resource should be sent to the designated Log Analytics workspace, providing precise control over log management.
Why the other options lose
- B. By linking the resources to the workspace directly: This option is incorrect because Azure does not support a direct link between resources and a Log Analytics workspace for log collection. Each resource must have its diagnostic settings configured.
- C. By using Azure Policy to enforce log collection: While Azure Policy is effective for compliance and governance, it does not manage log collection specifics. It cannot enforce which logs are sent to a particular workspace, making this option unsuitable for the question.
- D. By creating a custom script to manage log settings: Although this may seem like a viable solution, writing a custom script is not the most efficient or recommended approach. It adds unnecessary complexity when the diagnostic settings provide a built-in method to achieve the desired outcome.
The concept behind it
The underlying principle here is understanding how Azure Monitor and diagnostic settings operate. Each resource in Azure has diagnostic settings that allow administrators to choose which logs and metrics to send to particular Log Analytics workspaces. This targeted configuration is crucial for effective monitoring and management.
Exam trap to remember
Remember: Always configure diagnostic settings at the resource level for precise log management. This is your go-to method for ensuring logs are sent to specific Log Analytics workspaces.