Skip to content

Commit 3fd8800

Browse files
authored
Merge pull request #46784 from mmacy/aci-log-analytics-params-add
[ACI] log analytics name/ID params
2 parents 7c76dbe + 359f35b commit 3fd8800

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

articles/container-instances/container-instances-log-analytics.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ manager: jeconnoc
77

88
ms.service: container-instances
99
ms.topic: overview
10-
ms.date: 06/06/2018
10+
ms.date: 07/17/2018
1111
ms.author: marsma
1212
---
1313
# Container instance logging with Azure Log Analytics
@@ -38,9 +38,26 @@ To obtain the Log Analytics workspace ID and primary key:
3838

3939
## Create container group
4040

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.
4242

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**.
4461

4562
```yaml
4663
apiVersion: 2018-06-01
@@ -70,7 +87,7 @@ type: Microsoft.ContainerInstance/containerGroups
7087
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"):
7188

7289
```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
7491
```
7592

7693
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
129146
[fluentd]: https://hub.docker.com/r/fluent/fluentd/
130147
[query_lang]: https://docs.loganalytics.io/
131148

132-
<!-- LINKS - Internal -->
149+
<!-- LINKS - Internal -->
150+
[az-container-create]: /cli/azure/container#az-container-create

0 commit comments

Comments
 (0)