Skip to content

Commit a91558f

Browse files
copyedit updates
1 parent df826d1 commit a91558f

File tree

1 file changed

+100
-52
lines changed

1 file changed

+100
-52
lines changed

articles/container-apps/java-component-logs.md

Lines changed: 100 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,166 @@
11
---
2-
title: "Tutorial: Observability of managed Java components"
2+
title: Observability of managed Java components
33
description: Learn how to retrieve logs of managed Java components.
44
services: container-apps
55
author: craigshoemaker
66
ms.service: container-apps
77
ms.custom: devx-track-extended-java
8-
ms.topic: conceptual
9-
ms.date: 04/30/2024
8+
ms.topic: how-to
9+
ms.date: 05/01/2024
1010
ms.author: cshoe
1111
zone_pivot_groups: container-apps-portal-or-cli
1212
---
1313

1414
# Tutorial: Observability of managed Java components
1515

16-
Java components include built-in observability features that could give you a holistic view of Java component health throughout its lifecycle.
16+
Java components include built-in observability features that can give you a holistic view of Java component health throughout its lifecycle. In this tutorial, you learn how to query logs messages generated by a Java component.
1717

1818
## Prerequisites
1919

2020
The following prerequisites are required for this tutorial.
2121

2222
| Resource | Description |
2323
|---|---|
24-
| Azure Log Analytics | To use the built-in observability features of managed Java components, ensure you set up your Azure Log Analytics for logging and monitoring in a managed environment as outlined in the document, either using **Log Analytics** or **Azure Monitor**. [Log storage and monitoring options in Azure Container Apps](log-options.md) |
25-
| Java component | Make sure to create at least one Java component in your environment, such as [Eureka](java-eureka-server.md) and [config server](java-config-server.md). |
24+
| Azure Log Analytics | To use the built-in observability features of managed Java components, ensure you set up Azure Log Analytics to use Log Analytics or *Azure Monitor*. For more information, see [Log storage and monitoring options in Azure Container Apps](log-options.md). |
25+
| Java component | Make sure to create at least one Java component in your environment, such as [Eureka Server](java-eureka-server.md) or [Config Server](java-config-server.md). |
2626

2727
## Query log data
2828

29-
Log Analytics is a tool in the Azure portal used to view and analyze log data. Using Log Analytics, you can write Kusto queries to retrieve, sort, filter, and visualize the log data. These visualizations help you spot trends and identify issues with your application. You can work interactively with the query results or use them with other features such as alerts, dashboards, and workbooks.
29+
Log Analytics is a tool that helps you view and analyze log data. Using Log Analytics, you can write Kusto queries to retrieve, sort, filter, and visualize log data. These visualizations help you spot trends and identify issues with your application. You can work interactively with the query results or use them with other features such as alerts, dashboards, and workbooks.
3030

3131
::: zone pivot="azure-portal"
3232

33-
To query Java component logs in Azure, begin by accessing your Azure Log Analytics workspace associated with your environment. From there, proceed by selecting **Logs** from the sidebar.
33+
1. Open the Azure portal and go to your Azure Log Analytics workspace.
3434

35-
Focus your query on the Java component logs by utilizing the **ContainerAppSystemlogs_CL** table, which is found under the **CustomLogs** category in **Tables** tab.
35+
1. Select **Logs** from the sidebar.
3636

37-
:::image type="content" source="media/java-components-logs/java-component-logs.png" alt-text="Screenshot of the Log Analytics Java component logs.":::
37+
1. In the query tab, under the *Tables* section, under *Custom Logs*, select the **ContainerAppSystemlogs_CL** table.
3838

39-
The following Kusto query displays the log entries of Eureka Server for Spring component logs.
39+
1. Enter the following Kusto query to display Eureka Server logs for the Spring component.
4040

41-
```kusto
42-
ContainerAppSystemLogs_CL
43-
| where ComponentType_s == 'SpringCloudEureka'
44-
| project Time=TimeGenerated, Type=ComponentType_s, Component=ComponentName_s, Message=Log_s
45-
| take 100
46-
```
41+
```kusto
42+
ContainerAppSystemLogs_CL
43+
| where ComponentType_s == 'SpringCloudEureka'
44+
| project Time=TimeGenerated, Type=ComponentType_s, Component=ComponentName_s, Message=Log_s
45+
| take 100
46+
```
47+
48+
:::image type="content" source="media/java-components-logs/java-component-logs.png" alt-text="Screenshot of the Log Analytics Java component logs.":::
49+
50+
1. Select the **Run** button to run the query.
4751
4852
::: zone-end
4953
5054
::: zone pivot="azure-cli"
5155
52-
Java component logs can be queried using the [Azure CLI](/cli/azure/monitor/log-analytics).
56+
You query the component logs via the Azure CLI [log analytics](/cli/azure/monitor/log-analytics) extension.
5357
54-
The following example Azure CLI queries output a table containing log records for the Eureka Server for Spring component. The `project` operator's parameters specify the table columns. The `$WORKSPACE_CUSTOMER_ID` variable contains the GUID of the Log Analytics workspace.
58+
1. Run the following command to create a variable for your Log Analytics workspace ID.
5559
56-
# [Bash](#tab/bash)
60+
Make sure to replace `<WORKSPACE_ID>` with your Log Analytics workspace ID before running the query.
5761
58-
```azurecli
59-
az monitor log-analytics query --workspace $WORKSPACE_CUSTOMER_ID --analytics-query "ContainerAppSystemLogs_CL | where ComponentType_s == 'SpringCloudEureka' | project Time=TimeGenerated, Type=ComponentType_s, Component=ComponentName_s, Message=Log_s | take 5" --out table
60-
```
62+
# [Bash](#tab/bash)
6163
62-
# [PowerShell](#tab/powershell)
64+
```azurecli
65+
SET $WORKSPACE_ID=<WORKSPACE_ID>
66+
```
6367
64-
```powershell
65-
$queryResults = Invoke-AzOperationalInsightsQuery -WorkspaceId $WORKSPACE_CUSTOMER_ID -Query "ContainerAppSystemLogs_CL | where ComponentType_s == 'SpringCloudEureka' | project Time=TimeGenerated, Type=ComponentType_s, Component=ComponentName_s, Message=Log_s | take 5"
66-
$queryResults.Results
67-
```
68+
# [PowerShell](#tab/powershell)
6869
69-
---
70+
```powershell
71+
$WORKSPACE_ID = "<WORKSPACE_ID>"
72+
```
73+
74+
---
75+
76+
1. Run the following command to query the logs table.
77+
78+
# [Bash](#tab/bash)
79+
80+
```azurecli
81+
az monitor log-analytics query \
82+
--workspace $WORKSPACE_ID \
83+
--analytics-query "ContainerAppSystemLogs_CL | where ComponentType_s == 'SpringCloudEureka' | project Time=TimeGenerated, Type=ComponentType_s, Component=ComponentName_s, Message=Log_s | take 5" --out table
84+
```
85+
86+
# [PowerShell](#tab/powershell)
87+
88+
```powershell
89+
$queryResults = Invoke-AzOperationalInsightsQuery -WorkspaceId $WORKSPACE_ID -Query "ContainerAppSystemLogs_CL | where ComponentType_s == 'SpringCloudEureka' | project Time=TimeGenerated, Type=ComponentType_s, Component=ComponentName_s, Message=Log_s | take 5"
90+
$queryResults.Results
91+
```
92+
93+
---
94+
95+
The `project` operator's parameters specify the table columns.
7096
7197
::: zone-end
7298
7399
## Query Java Component Log with Azure monitor
74100
75-
Azure Monitor is a comprehensive monitoring solution for collecting, analyzing, and responding to monitoring data from your cloud and on-premises environments. Azure Monitor can direct logs to one or more destinations, here we take Log Analytics workspace being a primary example of such a destination.
101+
You can query Azure Monitor for monitoring data for your Java component logs.
76102
77103
::: zone pivot="azure-portal"
78104
79-
To query Java components in Azure using Azure Monitor, with Log Analytics workspace as the destination, you have two options: navigate directly to your Log Analytics workspace or access the logs through the Managed Environment's **Log** panel as follows.
105+
1. Open the Azure portal and go to your Container Apps environment.
80106
81-
Focus your query on the Java component logs by utilizing the **ContainerAppSystemLogs** table, which is found under the **Container Apps** category in **Tables** tab.
107+
1. From the sidebar, under the *Monitoring* section, select **Logs**.
82108
83-
:::image type="content" source="media/java-components-logs/java-component-logs.png" alt-text="Screenshot of the Log Analytics Java component logs portal location.":::
109+
1. In the query tab, in the *Tables* section, under the *Container Apps* heading, select the **ContainerAppSystemLogs** table.
84110
85-
The following Kusto query displays the log entries of Eureka Server for Spring component logs.
111+
1. Enter the following Kusto query to display the log entries of Eureka Server for Spring component logs.
86112
87-
```kusto
88-
ContainerAppSystemLogs
89-
| where ComponentType == "SpringCloudEureka"
90-
| project Time=TimeGenerated, Type=ComponentType, Component=ComponentName, Message=Log
91-
| take 100
92-
```
113+
```kusto
114+
ContainerAppSystemLogs
115+
| where ComponentType == "SpringCloudEureka"
116+
| project Time=TimeGenerated, Type=ComponentType, Component=ComponentName, Message=Log
117+
| take 100
118+
```
119+
120+
1. Select the **Run** button to run the query.
93121
94122
::: zone-end
95123
96124
::: zone pivot="azure-cli"
97125
98-
Java component logs can be queried using the [Azure CLI](/cli/azure/monitor/log-analytics).
126+
You query the component logs via the Azure CLI [log analytics](/cli/azure/monitor/log-analytics) extension.
99127
100-
The following example Azure CLI queries output a table containing log records for the Eureka Server for Spring component. The `project` operator's parameters specify the table columns. The `$WORKSPACE_CUSTOMER_ID` variable contains the GUID of the Log Analytics workspace.
128+
1. Run the following command to create a variable for your Log Analytics workspace ID.
101129
102-
# [Bash](#tab/bash)
130+
Make sure to replace `<WORKSPACE_ID>` with your Log Analytics workspace ID before running the query.
103131
104-
```azurecli
105-
az monitor log-analytics query --workspace $WORKSPACE_CUSTOMER_ID --analytics-query "ContainerAppSystemLogs | where ComponentType == 'SpringCloudEureka' | project Time=TimeGenerated, Type=ComponentType, Component=ComponentName, Message=Log | take 5" --out table
106-
```
132+
# [Bash](#tab/bash)
107133
108-
# [PowerShell](#tab/powershell)
134+
```azurecli
135+
SET $WORKSPACE_ID=<WORKSPACE_ID>
136+
```
109137
110-
```powershell
111-
$queryResults = Invoke-AzOperationalInsightsQuery -WorkspaceId $WORKSPACE_CUSTOMER_ID -Query "ContainerAppSystemLogs | where ComponentType == 'SpringCloudEureka' | project Time=TimeGenerated, Type=ComponentType, Component=ComponentName, Message=Log | take 5"
112-
$queryResults.Results
113-
```
138+
# [PowerShell](#tab/powershell)
114139
115-
---
140+
```powershell
141+
$WORKSPACE_ID = "<WORKSPACE_ID>"
142+
```
143+
144+
---
145+
146+
1. Run the following command to query the logs table.
147+
148+
# [Bash](#tab/bash)
149+
150+
```azurecli
151+
az monitor log-analytics query --workspace $WORKSPACE_CUSTOMER_ID --analytics-query "ContainerAppSystemLogs | where ComponentType == 'SpringCloudEureka' | project Time=TimeGenerated, Type=ComponentType, Component=ComponentName, Message=Log | take 5" --out table
152+
```
153+
154+
# [PowerShell](#tab/powershell)
155+
156+
```powershell
157+
$queryResults = Invoke-AzOperationalInsightsQuery -WorkspaceId $WORKSPACE_ID -Query "ContainerAppSystemLogs | where ComponentType == 'SpringCloudEureka' | project Time=TimeGenerated, Type=ComponentType, Component=ComponentName, Message=Log | take 5"
158+
$queryResults.Results
159+
```
160+
161+
---
162+
163+
The `project` operator's parameters specify the table columns.
116164
117165
::: zone-end
118166

0 commit comments

Comments
 (0)