Skip to content

Commit be9dfa3

Browse files
authored
Merge pull request #190013 from bwren/tutorial-fix
Fixes for custom logs tutorial
2 parents 81551b8 + 13fe783 commit be9dfa3

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

articles/azure-monitor/logs/tutorial-custom-logs-api.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,12 @@ Once the data collection rule has been created, the application needs to be give
340340
## Send sample data
341341
The following PowerShell code sends data to the endpoint using HTTP REST fundamentals.
342342
343+
1. Run the following PowerShell command which adds a required assembly for the script.
344+
345+
```powershell
346+
Add-Type -AssemblyName System.Web
347+
```
348+
343349
1. Replace the parameters in the *step 0* section with values from the resources that you just created. You may also want to replace the sample data in the *step 2* section with your own.
344350
345351
```powershell
@@ -364,8 +370,6 @@ The following PowerShell code sends data to the endpoint using HTTP REST fundame
364370
$uri = "https://login.microsoftonline.com/$tenantId/oauth2/v2.0/token"
365371
366372
$bearerToken = (Invoke-RestMethod -Uri $uri -Method "Post" -Body $body -Headers $headers).access_token
367-
### If the above line throws an 'Unable to find type [System.Web.HttpUtility].' error, execute the line below separately from the rest of the code
368-
# Add-Type -AssemblyName System.Web
369373
370374
##################
371375
### Step 2: Load up some sample data.
@@ -427,9 +431,6 @@ API limits have been exceeded. The limits are currently set to 500MB of data/min
427431
### Script returns error code 503
428432
Ensure that you have the correct permissions for your application to the DCR. You may also need to wait up to 30 minutes for permissions to propagate.
429433
430-
### Script returns error `Unable to find type [System.Web.HttpUtility]`
431-
Run the last line in section 1 of the script for a fix and execute it directly. Executing it uncommented as part of the script will not resolve the issue. The command must be executed separately.
432-
433434
### You don't receive an error, but data doesn't appear in the workspace
434435
The data may take some time to be ingested, especially if this is the first time data is being sent to a particular table. It shouldn't take longer than 15 minutes.
435436

articles/azure-monitor/logs/tutorial-custom-logs.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ A [data collection endpoint (DCE)](../essentials/data-collection-endpoint-overvi
7373
## Generate sample data
7474
The following PowerShell script both generates sample data to configure the custom table and sends sample data to the custom logs API to test the configuration.
7575

76-
1. Update the values of `$tenantId`, `$appId`, and `$appSecret` with the values you noted for **Directory (tenant) ID**, **Application (client) ID**, and secret **Value** and then save with the file name *LogGenerator.ps1*.
76+
1. Run the following PowerShell command which adds a required assembly for the script.
77+
78+
```powershell
79+
Add-Type -AssemblyName System.Web
80+
```
81+
82+
2. Update the values of `$tenantId`, `$appId`, and `$appSecret` with the values you noted for **Directory (tenant) ID**, **Application (client) ID**, and secret **Value** and then save with the file name *LogGenerator.ps1*.
7783
7884
``` PowerShell
7985
param ([Parameter(Mandatory=$true)] $Log, $Type="file", $Output, $DcrImmutableId, $DceURI, $Table)
@@ -145,8 +151,6 @@ The following PowerShell script both generates sample data to configure the cust
145151
$headers = @{"Content-Type" = "application/x-www-form-urlencoded" };
146152
$uri = "https://login.microsoftonline.com/$tenantId/oauth2/v2.0/token"
147153
$bearerToken = (Invoke-RestMethod -Uri $uri -Method "Post" -Body $body -Headers $headers).access_token
148-
## If the above line throws an 'Unable to find type [System.Web.HttpUtility].' error, execute the line below separately from the rest of the code
149-
# Add-Type -AssemblyName System.Web
150154
151155
## Generate and send some data
152156
foreach ($line in $file_data) {
@@ -173,16 +177,14 @@ The following PowerShell script both generates sample data to configure the cust
173177
}
174178
```
175179
176-
2. Copy the sample log data from [sample data](#sample-data) or copy your own Apache log data into a file called *sample_access.log*. Run the script using the following command to read this data and create a JSON file called *data_sample.json* that you can send to the custom logs API.
180+
3. Copy the sample log data from [sample data](#sample-data) or copy your own Apache log data into a file called *sample_access.log*.
177181
178182
```PowerShell
179183
.\LogGenerator.ps1 -Log "sample_access.log" -Type "file" -Output "data_sample.json"
180184
```
181185
182-
3. Run the script using the following command to read this data and create a JSON file called *data_sample.json* that you can send to the custom logs API.
186+
4. Run the script using the following command to read this data and create a JSON file called *data_sample.json* that you can send to the custom logs API.
183187
184-
:::image type="content" source="media/tutorial-custom-logs/new-custom-log.png" lightbox="media/tutorial-custom-logs/new-custom-log.png" alt-text="Screenshot showing new DCR-based custom log.":::
185-
186188
## Add custom log table
187189
Before you can send data to the workspace, you need to create the custom table that the data will be sent to.
188190
@@ -317,7 +319,7 @@ Allow at least 30 minutes for the configuration to take effect. You may also exp
317319
1. Run the following command providing the values that you collected for your data collection rule and data collection endpoint. The script will start ingesting data by placing calls to the API at pace of approximately 1 record per second.
318320
319321
```PowerShell
320-
.\LogGenerator.ps1 -Log "sample_access.log" -Type "API" -Table "ApacheAccess_CL" -DcrImmutableId <immutable ID> -DceUrl <data collection endpoint URL>
322+
.\LogGenerator.ps1 -Log "sample_access.log" -Type "API" -Table "ApacheAccess_CL" -DcrImmutableId <immutable ID> -DceUri <data collection endpoint URL>
321323
```
322324

323325
2. From Log Analytics, query your newly created table to verify that data arrived and if it is transformed properly.
@@ -336,9 +338,6 @@ API limits have been exceeded. The limits are currently set to 500MB of data/min
336338
### Script returns error code 503
337339
Ensure that you have the correct permissions for your application to the DCR. You may also need to wait up to 30 minutes for permissions to propagate.
338340

339-
### Script returns error `Unable to find type [System.Web.HttpUtility]`
340-
Run the last line in section 1 of the script for a fix and execute it directly. Executing it uncommented as part of the script will not resolve the issue. The command must be executed separately.
341-
342341
### You don't receive an error, but data doesn't appear in the workspace
343342
The data may take some time to be ingested, especially if this is the first time data is being sent to a particular table. It shouldn't take longer than 15 minutes.
344343

0 commit comments

Comments
 (0)