Quickstart: Analyze logs and metrics in the Azure Spring Apps Standard consumption and dedicated plan
Note
The Basic, Standard, and Enterprise plans will be deprecated starting from mid-March, 2025, with a 3 year retirement period. We recommend transitioning to Azure Container Apps. For more information, see the Azure Spring Apps retirement announcement.
The Standard consumption and dedicated plan will be deprecated starting September 30, 2024, with a complete shutdown after six months. We recommend transitioning to Azure Container Apps. For more information, see Migrate Azure Spring Apps Standard consumption and dedicated plan to Azure Container Apps.
This article applies to: ✔️ Standard consumption and dedicated (Preview) ❌ Basic/Standard ❌ Enterprise
This article shows you how to analyze logs and metrics in the Azure Spring Apps Standard consumption and dedicated plan.
Prerequisites
- An Azure subscription. If you don't have a subscription, create a free account before you begin.
- An Azure Spring Apps Standard consumption and dedicated plan service instance. For more information, see Quickstart: Provision an Azure Spring Apps Standard consumption and dedicated plan service instance.
- A Spring app deployed to Azure Spring Apps.
Analyze logs
The following sections describe various tools in Azure that you can use to analyze your consumption and dedicated plan usage.
Configure logging options
You can configure logging options in the Azure Container Apps environment where you deploy your Azure Spring Apps instance. You can choose between the following log destinations:
Log Analytics - Azure Monitor Log Analytics is the default storage and viewing option. Your logs are stored in a Log Analytics workspace where you can view and analyze them using Log Analytics queries.
Azure Monitor - Azure Monitor routes logs to one or more of the following destinations:
- A Log Analytics workspace for viewing and analysis.
- An Azure storage account to archive.
- An Azure event hub for data ingestion and analytic services.
- An Azure partner monitoring solution such as Datadog, Elastic, Logz.io, and others.
None - You can disable the storage of log data.
You can enable logs in Azure Spring Apps in the following ways:
- When you select Log Analytics as the logging option.
- When you select Azure Monitor as the logging option, with the Spring App console logs category selected in the Diagnostic setting.
For more information, see Log storage and monitoring options in Azure Container Apps.
Query logs by using Log Analytics
Log Analytics is a tool in the Azure portal that you can use to view and analyze log data. By using Log Analytics, you can write Kusto queries and then sort, filter, and visualize the results in charts to spot trends and identify issues. You can work interactively with the query results or use them with other features such as alerts, dashboards, and workbooks.
The following sections describe various methods to view logs.
Use logs
Use the following steps to query log data.
In the Azure portal, go to your Azure Spring Apps instance.
Select Logs from the navigation pane.
In the New Query 1 settings, enter a query such as the following example:
AppEnvSpringAppConsoleLogs_CL | limit 50
Select Run.
Use Log Analytics
Use the following steps to perform analytics on log data.
In the Azure portal, go to your Azure Spring Apps instance.
Select Log Analytics in the navigation pane.
Select the Log Analytics workspace where you chose to store the logs.
To open the Log Search pane, select Logs.
To view logs, in the Tables search box, enter a query such as the following example:
AppEnvSpringAppConsoleLogs_CL | limit 50
To view the search result, select Run.
You can search the logs of the specific application, deployment, or instance by setting a filter condition, as shown in the following example:
AppEnvSpringAppConsoleLogs_CL | where ContainerAppName_s == "YourAppName" and RevisionName_s has "YourDeploymentName" and ContainerGroupName_s == "YourInstanceName" | limit 50
Note
==
is case sensitive, but=~
isn't.
To learn more about the query language used in Log Analytics, see Kusto Query Language (KQL) overview. To query all your Log Analytics logs from a centralized client, see Query data in Azure Monitor using Azure Data Explorer.
Analyze metrics
Azure Monitor collects metric data from your Azure Spring Apps instance at regular intervals to help you gain insights into the performance and health of your Spring apps.
To visualize the data, select Metrics in the navigation pane in your Azure Spring Apps instance. You can also retrieve raw metric data through the Azure CLI and Azure PowerShell cmdlets.
Available metrics
Azure Spring Apps provides the metrics described in the following table:
Title | Description | Metric ID | Unit |
---|---|---|---|
CPU usage nanocores | CPU usage in nanocores (1,000,000,000 nanocores = 1 core) | UsageNanoCores |
nanocores |
Memory working set bytes | Working set memory used in bytes | WorkingSetBytes |
bytes |
Network in bytes | Network received bytes | RxBytes |
bytes |
Network out bytes | Network transmitted bytes | TxBytes |
bytes |
Requests | Requests processed | Requests |
n/a |
Restart count | Restart count of Spring App | RestartCount |
n/a |
Use metrics explorer
The Azure Monitor metrics explorer enables you to create charts from metric data to help you analyze your Azure Spring Apps resource and network usage over time. You can pin charts to a dashboard or in a shared workbook.
Open the metrics explorer in the Azure portal by selecting Metrics in the navigation pane on the overview page of your Azure Spring Apps instance. To learn more about metrics explorer, see Analyze metrics with Azure Monitor metrics explorer.
Create a chart by selecting a metric in the Metric dropdown menu. You can modify the chart by changing the aggregation, adding more metrics, changing time ranges and intervals, adding filters, and applying splitting.
Add filters
Optionally, you can create filters to limit the data shown based on application name and instance name. Use the following steps to create a filter:
- Select Add filter.
- Select App or Instance from the Property list.
- Select values from the Value list.