You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/container-apps/log-streaming.md
+86-11Lines changed: 86 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,35 +16,58 @@ While developing and troubleshooting your container app, it's important to see a
16
16
17
17
## Azure portal
18
18
19
-
View a container app's log stream in the Azure portal with these steps.
19
+
You can view system logs and application logs in the Azure portal. System logs are generated by the container app's runtime. Application logs are generated by your container app's application.
20
20
21
-
1. Navigate to your container app in the Azure portal.
21
+
### Environment system log stream
22
+
23
+
To troubleshoot issues with in your container app environment, you can view the system log stream from your environment page. The log stream displays the system logs for the Container Apps service and the apps actively running in the environment:
24
+
25
+
1. Go your environment page in the Azure portal.
26
+
1. Select **Log stream** under the *Monitoring* section on the sidebar menu.
27
+
28
+
:::image type="content" source="media/observability/system-log-streaming-env.png" alt-text="Screenshot of Container Apps environment system log stream page.":::
29
+
30
+
### Container app log stream
31
+
32
+
You can view a log stream of your container apps system or application logs from your container app page.
33
+
34
+
1. Go to your container app in the Azure portal.
22
35
1. Select **Log stream** under the *Monitoring* section on the sidebar menu.
23
-
1. If you have multiple revisions, replicas, or containers, you can select from the pull-down menus to choose a container. If your app has only one container, you can skip this step.
36
+
1. To view the console log stream, select **Console**.
37
+
1. If you have multiple revisions, replicas, or containers, you can select from the pull-down menus to choose a container. If your app has only one container, you can skip this step.
24
38
25
-
After a container is selected, the logstream is displayed in the viewing pane.
39
+
:::image type="content" source="media/observability/screenshot-log-stream-console-app.png" alt-text="Screenshot of Container Apps console log stream from app page.":::
1. To view the system log stream, select **System**. The system log stream displays the system logs for all running containers in the environment.
42
+
43
+
:::image type="content" source="media/observability/screenshot-log-stream-system-app.png" alt-text="Screenshot of Container Apps system log stream from app page.":::
28
44
29
45
## Azure CLI
30
46
31
-
You can view a container's log stream from the Azure CLI with the `az containerapp logs show` command. You can use these arguments to:
47
+
You can view an active container's log stream from the Azure CLI with the `az containerapp logs show` command or your container app's environment system log stream with the `az containerapp env logs show` command. The environment system log stream displays the system logs for the Container Apps service and the apps running in the environment.
48
+
49
+
You can use these arguments to:
32
50
33
-
- View previous log entries with the `--tail` argument.
51
+
- View previous log entries with the `--tail` argument. (Values: 0-300)
34
52
- View a live stream with the `--follow`argument.
35
53
36
54
Use `Ctrl/Cmd-C` to stop the live stream.
37
55
38
56
For example, you can list the last 50 container log entries in a container app with a single container using the following command.
39
57
40
-
This example live streams a container's log entries.
58
+
### View container app log stream from the CLI
59
+
60
+
Use the `--type` argument to specify the log type. Valid values are `console` and `system`. The default is `console`.
61
+
62
+
This example displays the last 50 system log entries for the container app.
41
63
42
64
# [Bash](#tab/bash)
43
65
44
66
```azurecli
45
67
az containerapp logs show \
46
68
--name <ContainerAppName> \
47
69
--resource-group <ResourceGroup> \
70
+
--type system \
48
71
--tail 50
49
72
```
50
73
@@ -54,12 +77,13 @@ az containerapp logs show \
54
77
az containerapp logs show `
55
78
--name <ContainerAppName> `
56
79
--resource-group <ResourceGroup> `
80
+
--type system `
57
81
--tail 50
58
82
```
59
83
60
84
---
61
85
62
-
To connect to a container console in a container app with multiple revisions, replicas, and containers include the following parameters in the `az containerapp logs show` command.
86
+
To connect to a container live console log stream in a container app with multiple revisions, replicas, and containers include the following parameters in the `az containerapp logs show` command.
63
87
64
88
| Argument | Description |
65
89
|----------|-------------|
@@ -113,8 +137,7 @@ az containerapp replica list `
113
137
114
138
---
115
139
116
-
Stream the container logs with the `az container app show` command. Replace the \<placeholders\> with your container app's values.
117
-
140
+
Stream the container console logs with the `az container app show` command. Replace the \<placeholders\> with your container app's values.
118
141
119
142
# [Bash](#tab/bash)
120
143
@@ -125,6 +148,7 @@ az containerapp logs show \
125
148
--revision <RevisionName> \
126
149
--replica <ReplicaName> \
127
150
--container <ContainerName> \
151
+
--type console \
128
152
--follow
129
153
```
130
154
@@ -137,13 +161,64 @@ az containerapp logs show `
137
161
--revision <RevisionName> `
138
162
--replica <ReplicaName> `
139
163
--container <ContainerName> `
164
+
--type console `
140
165
--follow
141
166
```
142
167
143
168
---
144
169
170
+
Enter **Ctrl-C** to stop the log stream.
171
+
172
+
### View environment system log stream from the CLI
173
+
174
+
Using the following command, you can view the system log stream for the Container Apps service and the apps running in the environment.
175
+
176
+
Stream the container logs with the `az container app env logs show` command. Replace the \<placeholders\> with your container app's values.
177
+
178
+
179
+
# [Bash](#tab/bash)
180
+
181
+
```azurecli
182
+
az containerapp env logs show \
183
+
--name <ContainerAppEnvironmentName> \
184
+
--resource-group <ResourceGroup> \
185
+
--follow
186
+
```
187
+
188
+
# [PowerShell](#tab/powershell)
189
+
190
+
```azurecli
191
+
az containerapp env logs show `
192
+
--name <ContainerAppEnvironmentName> `
193
+
--resource-group <ResourceGroup> `
194
+
--follow
195
+
```
196
+
197
+
---
145
198
146
199
Enter **Ctrl-C** to stop the log stream.
147
200
201
+
This example displays the last 50 environment system log entries.
202
+
203
+
# [Bash](#tab/bash)
204
+
205
+
```azurecli
206
+
az containerapp logs show \
207
+
--name <ContainerAppName> \
208
+
--resource-group <ResourceGroup> \
209
+
--tail 50
210
+
```
211
+
212
+
# [PowerShell](#tab/powershell)
213
+
214
+
```azurecli
215
+
az containerapp logs show `
216
+
--name <ContainerAppName> `
217
+
--resource-group <ResourceGroup> `
218
+
--tail 50
219
+
```
220
+
221
+
---
222
+
148
223
> [!div class="nextstepaction"]
149
224
> [View log streams from the Azure portal](log-streaming.md)
0 commit comments