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-instances/container-instances-log-analytics.md
+23-5Lines changed: 23 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ manager: jeconnoc
7
7
8
8
ms.service: container-instances
9
9
ms.topic: overview
10
-
ms.date: 06/06/2018
10
+
ms.date: 07/17/2018
11
11
ms.author: marsma
12
12
---
13
13
# Container instance logging with Azure Log Analytics
@@ -38,9 +38,26 @@ To obtain the Log Analytics workspace ID and primary key:
38
38
39
39
## Create container group
40
40
41
-
Now that you have the Log Analytics workspace ID and primary key, you're ready to create a logging-enabled container group. The following example creates a container group with a single [fluentd][fluentd] container. The Fluentd container produces several lines of output in its default configuration. Because this output is sent to your Log Analytics workspace, it works well for demonstrating the viewing and querying of logs.
41
+
Now that you have the Log Analytics workspace ID and primary key, you're ready to create a logging-enabled container group.
42
42
43
-
First, copy the following YAML, which defines a container group with a single container, into a new file. Replace `LOG_ANALYTICS_WORKSPACE_ID` and `LOG_ANALYTICS_WORKSPACE_KEY` with the values you obtained in the previous step, then save the file as **deploy-aci.yaml**.
43
+
The following examples demonstrate two ways to create a container group with a single [fluentd][fluentd] container: Azure CLI, and Azure CLI with a YAML template. The Fluentd container produces several lines of output in its default configuration. Because this output is sent to your Log Analytics workspace, it works well for demonstrating the viewing and querying of logs.
44
+
45
+
### Deploy with Azure CLI
46
+
47
+
To deploy with the Azure CLI, specify the `--log-analytics-workspace` and `--log-analytics-workspace-key` parameters in the [az container create][az-container-create] command. Replace the two workspace values with the values you obtained in the previous step (and update the resource group name) before running the following command.
48
+
49
+
```azurecli-interactive
50
+
az container create \
51
+
--resource-group myResourceGroup \
52
+
--name mycontainergroup001 \
53
+
--image fluent/fluentd \
54
+
--log-analytics-workspace <WORKSPACE_ID> \
55
+
--log-analytics-workspace-key <WORKSPACE_KEY>
56
+
```
57
+
58
+
### Deploy with YAML
59
+
60
+
Use this method if you prefer to deploy container groups with YAML. The following YAML defines a container group with a single container. Copy the YAML into a new file, then replace `LOG_ANALYTICS_WORKSPACE_ID` and `LOG_ANALYTICS_WORKSPACE_KEY` with the values you obtained in the previous step. Save file as **deploy-aci.yaml**.
Next, execute the following command to deploy the container group; replace `myResourceGroup` with a resource group in your subscription (or first create a resource group named "myResourceGroup"):
71
88
72
89
```azurecli-interactive
73
-
az container create -g myResourceGroup -n mycontainergroup001 -f deploy-aci.yaml
90
+
az container create --resource-group myResourceGroup --name mycontainergroup001 --file deploy-aci.yaml
74
91
```
75
92
76
93
You should receive a response from Azure containing deployment details shortly after issuing the command.
@@ -129,4 +146,5 @@ For information about monitoring container instance CPU and memory resources, se
0 commit comments