Skip to content

Commit d140e0b

Browse files
authored
Merge pull request #199736 from dnethi/patch-27
Update upload-logs.md
2 parents 74a84bc + b4bc52c commit d140e0b

File tree

1 file changed

+55
-8
lines changed

1 file changed

+55
-8
lines changed

articles/azure-arc/data/upload-logs.md

Lines changed: 55 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ description: Upload logs for Azure Arc-enabled data services to Azure Monitor
44
services: azure-arc
55
ms.service: azure-arc
66
ms.subservice: azure-arc-data
7-
author: twright-msft
8-
ms.author: twright
7+
author: dnethi
8+
ms.author: dinethi
99
ms.reviewer: mikeray
10-
ms.date: 11/03/2021
10+
ms.date: 05/27/2022
1111
ms.topic: how-to
1212
---
1313

@@ -149,9 +149,9 @@ echo $WORKSPACE_SHARED_KEY
149149

150150
With the environment variables set, you can upload logs to the log workspace.
151151

152-
## Upload logs to Azure Log Analytics Workspace in direct mode
152+
## Configure automatic upload of logs to Azure Log Analytics Workspace in direct mode using `az` CLI
153153

154-
In the **direct** connected mode, Logs upload can only be setup in **automatic** mode. This automatic upload of metrics can be setup either during deployment or post deployment of Azure Arc data controller.
154+
In the **direct** connected mode, Logs upload can only be set up in **automatic** mode. This automatic upload of metrics can be set up either during deployment or post deployment of Azure Arc data controller.
155155

156156
### Enable automatic upload of logs to Azure Log Analytics Workspace
157157

@@ -163,7 +163,7 @@ az arcdata dc update --name <name of datacontroller> --resource-group <resource
163163
az arcdata dc update --name arcdc --resource-group <myresourcegroup> --auto-upload-logs true
164164
```
165165

166-
### Disable automatic upload of logs to Azure Log Analytics Workspace
166+
### Enable automatic upload of logs to Azure Log Analytics Workspace
167167

168168
If the automatic upload of logs was enabled during Azure Arc data controller deployment, run the below command to disable automatic upload of logs.
169169
```
@@ -172,7 +172,54 @@ az arcdata dc update --name <name of datacontroller> --resource-group <resource
172172
az arcdata dc update --name arcdc --resource-group <myresourcegroup> --auto-upload-logs false
173173
```
174174

175-
## Upload logs to Azure Monitor in indirect mode
175+
## Configure automatic upload of logs to Azure Log Analytics Workspace in **direct** mode using `kubectl` CLI
176+
177+
### Enable automatic upload of logs to Azure Log Analytics Workspace
178+
179+
To configure automatic upload of logs using ```kubectl```:
180+
181+
- ensure the Log Analytics Workspace is created as described in the earlier section
182+
- create a Kubernetes secret for the Log Analytics workspace using the ```WorkspaceID``` and `SharedAccessKey` as follows:
183+
184+
```
185+
apiVersion: v1
186+
data:
187+
primaryKey: <base64 encoding of Azure Log Analytics workspace primary key>
188+
workspaceId: <base64 encoding of Azure Log Analytics workspace Id>
189+
kind: Secret
190+
metadata:
191+
name: log-workspace-secret
192+
namespace: <your datacontroller namespace>
193+
type: Opaque
194+
```
195+
196+
- To create the secret, run:
197+
198+
```console
199+
kubectl apply -f <myLogAnalyticssecret.yaml> --namespace <mynamespace>
200+
```
201+
202+
- To open the settings as a yaml file in the default editor, run:
203+
204+
```console
205+
kubectl edit datacontroller <DC name> --name <namespace>
206+
```
207+
208+
- update the autoUploadLogs property to ```"true"```, and save the file
209+
210+
211+
212+
### Enable automatic upload of logs to Azure Log Analytics Workspace
213+
214+
To disable automatic upload of logs, run:
215+
216+
```console
217+
kubectl edit datacontroller <DC name> --name <namespace>
218+
```
219+
220+
- update the autoUploadLogs property to `"false"`, and save the file
221+
222+
## Upload logs to Azure Monitor in **indirect** mode
176223

177224
To upload logs for your Azure Arc-enabled SQL managed instances and Azure Arc-enabled PostgreSQL Hyperscale server groups run the following CLI commands-
178225

@@ -210,7 +257,7 @@ Once your logs are uploaded, you should be able to query them using the log quer
210257

211258
If you want to upload metrics and logs on a scheduled basis, you can create a script and run it on a timer every few minutes. Below is an example of automating the uploads using a Linux shell script.
212259

213-
In your favorite text/code editor, add the following script to the file and save as a script executable file such as .sh (Linux/Mac) or .cmd, .bat, .ps1.
260+
In your favorite text/code editor, add the following script to the file and save as a script executable file - such as .sh for Linux/Mac, or .cmd, .bat, or .ps1 for Windows.
214261

215262
```azurecli
216263
az arcdata dc export --type logs --path logs.json --force --k8s-namespace arc

0 commit comments

Comments
 (0)