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/azure-monitor/essentials/data-collection-rule-edit.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,12 +43,12 @@ In order to update DCR, we are going to retrieve its content and save it as a fi
43
43
44
44
2. Execute the following commands to retrieve DCR content and save it to a file. Replace `<ResourceId>` with DCR ResourceID and `<FilePath>` with the name of the file to store DCR.
45
45
46
-
```PowerShell
47
-
$ResourceId = “<ResourceId>” # Resource ID of the DCR to edit
48
-
$FilePath = “<FilePath>” # Store DCR content in this file
49
-
$DCR = Invoke-AzRestMethod -Path ("$ResourceId"+"?api-version=2021-09-01-preview") -Method GET
Now, when DCR content is stored as a JSON file, you can use an editor of your choice to make changes in the DCR. You may [prefer to download the file from the Cloud Shell environment](../../cloud-shell/using-the-shell-window.md#upload-and-download-files), if you are using one.
54
54
@@ -60,25 +60,25 @@ code "temp.dcr"
60
60
Let’s modify the KQL transformation within DCR to drop rows where RequestType is anything, but “GET”.
61
61
1. Open the file created in the previous part for editing using an editor of your choice.
62
62
2. Locate the line containing `”transformKql”` attribute, which, if you followed the tutorial for custom log creation, should look similar to this:
Our final step is to update DCR back in the system. This is accomplished by “PUT” HTTP call to ARM API, with updated DCR content sent in the HTTP request body.
74
74
1. If you are using Azure Cloud Shell, save the file and close the embedded editor, or [upload modified DCR file back to the Cloud Shell environment](../../cloud-shell/using-the-shell-window.md#upload-and-download-files).
75
75
2. Execute the following commands to load DCR content from the file and place HTTP call to update the DCR in the system. Replace `<ResourceId>` with DCR ResourceID and `<FilePath>` with the name of the file modified in the previous part of the tutorial. You can omit first two lines if you read and write to the DCR within the same PowerShell session.
76
-
```PowerShell
77
-
$ResourceId = “<ResourceId>” # Resource ID of the DCR to edit
78
-
$FilePath = “<FilePath>” # Store DCR content in this file
79
-
$DCRContent = Get-Content $FilePath -Raw
80
-
Invoke-AzRestMethod -Path ("$ResourceId"+"?api-version=2021-09-01-preview") -Method PUT -Payload $DCRContent
81
-
```
76
+
```PowerShell
77
+
$ResourceId = “<ResourceId>” # Resource ID of the DCR to edit
78
+
$FilePath = “<FilePath>” # Store DCR content in this file
79
+
$DCRContent = Get-Content $FilePath -Raw
80
+
Invoke-AzRestMethod -Path ("$ResourceId"+"?api-version=2021-09-01-preview") -Method PUT -Payload $DCRContent
81
+
```
82
82
3. Upon successful call, you should get the response with status code “200”, indicating that your DCR is now updated.
83
83
4. You can now navigate to your DCR and examine its content on the portal via “JSON View” function, or you could repeat the first part of the tutorial to retrieve DCR content into a file.
0 commit comments