Collect and analyze resource logs from an Azure resource
Prerequisites: An Azure resource to monitor. You can use any resource in your Azure subscription that supports diagnostic settings. To determine whether a resource supports diagnostic settings, go to its menu in the Azure portal and verify that there’s a Diagnostic settings option in the Monitoring section of the menu.
- From All services in the Azure portal, select Log Analytics workspaces.
- Click Create to create a new workspace.
- On the Basics tab, select a Subscription, Resource group, and Region for the workspace. These do not need to be the same as the resource being monitored. Provide a Name that must be globally unique across all Azure Monitor subscriptions.
- Click Review + Create to create the workspace.
Create a diagnostic setting
- Under the Monitoring section of your resource’s menu, select Diagnostic settings and click Add diagnostic setting.
- Each diagnostic setting has three basic parts
- Click Save to save the diagnostic settings.
Use a log query to retrieve logs
- Select Logs from your resource’s menu. Log Analytics opens with the Queries window that includes prebuilt queries for your Resource type.
- Browse through the available queries. Identify one to run and click Run. The query is added to the query window and the results returned.
Tag:Azure