Skip to content

Commit 94f4b57

Browse files
committed
indents
1 parent 17b300c commit 94f4b57

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

articles/azure-monitor/essentials/data-collection-rule-edit.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ In order to update DCR, we are going to retrieve its content and save it as a fi
4343

4444
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.
4545

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
50-
$DCR.Content | ConvertFrom-Json | ConvertTo-Json -Depth 20 | Out-File -FilePath $FilePath
51-
```
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
50+
$DCR.Content | ConvertFrom-Json | ConvertTo-Json -Depth 20 | Out-File -FilePath $FilePath
51+
```
5252
## Edit DCR
5353
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.
5454
@@ -60,25 +60,25 @@ code "temp.dcr"
6060
Let’s modify the KQL transformation within DCR to drop rows where RequestType is anything, but “GET”.
6161
1. Open the file created in the previous part for editing using an editor of your choice.
6262
2. Locate the line containing `”transformKql”` attribute, which, if you followed the tutorial for custom log creation, should look similar to this:
63-
``` JSON
64-
"transformKql": " source\n | extend TimeGenerated = todatetime(Time)\n | parse RawData with \n ClientIP:string\n ' ' *\n ' ' *\n ' [' * '] \"' RequestType:string\n \" \" Resource:string\n \" \" *\n '\" ' ResponseCode:int\n \" \" *\n | where ResponseCode != 200\n | project-away Time, RawData\n"
65-
```
63+
``` JSON
64+
"transformKql": " source\n | extend TimeGenerated = todatetime(Time)\n | parse RawData with \n ClientIP:string\n ' ' *\n ' ' *\n ' [' * '] \"' RequestType:string\n \" \" Resource:string\n \" \" *\n '\" ' ResponseCode:int\n \" \" *\n | where ResponseCode != 200\n | project-away Time, RawData\n"
65+
```
6666
3. Modify KQL transformation to include additional filter by RequestType
67-
``` JSON
68-
"transformKql": " source\n | where RawData contains \"GET\"\n | extend TimeGenerated = todatetime(Time)\n | parse RawData with \n ClientIP:string\n ' ' *\n ' ' *\n ' [' * '] \"' RequestType:string\n \" \" Resource:string\n \" \" *\n '\" ' ResponseCode:int\n \" \" *\n | where ResponseCode != 200\n | project-away Time, RawData\n"
69-
```
67+
``` JSON
68+
"transformKql": " source\n | where RawData contains \"GET\"\n | extend TimeGenerated = todatetime(Time)\n | parse RawData with \n ClientIP:string\n ' ' *\n ' ' *\n ' [' * '] \"' RequestType:string\n \" \" Resource:string\n \" \" *\n '\" ' ResponseCode:int\n \" \" *\n | where ResponseCode != 200\n | project-away Time, RawData\n"
69+
```
7070
4. Save the file with modified DCR content.
7171

7272
## Apply changes
7373
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.
7474
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).
7575
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+
```
8282
3. Upon successful call, you should get the response with status code “200”, indicating that your DCR is now updated.
8383
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.
8484

0 commit comments

Comments
 (0)