Skip to content

Commit 545ed7f

Browse files
authored
Merge pull request #185199 from oshezaf/asim/update-testing-tools
Update ASIM testing tools
2 parents bb0aff7 + 50110d6 commit 545ed7f

File tree

1 file changed

+58
-32
lines changed

1 file changed

+58
-32
lines changed

articles/sentinel/normalization-develop-parsers.md

Lines changed: 58 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -222,19 +222,70 @@ You can also combine multiple templates to a single deploy process using [linked
222222

223223
## Test parsers
224224

225-
### Mandatory tests
225+
### Install ASIM testing tools
226226

227-
The following tests are mandatory. A parser that fails will prevent queries using the schema unifying parsers it is part of from working correctly:
227+
To test ASIM, [deploy the ASIM testing tool](https://aka.ms/ASimTestingTools) to a Microsoft Sentinel workspace where:
228+
- Your parser is deployed.
229+
- The source table used by the parser is available.
230+
- The source table used by the parser is populated with a varied collection of relevant events.
228231

229-
- Make sure that the parser produces all mandatory fields.
232+
### Validate the output schema
230233

231-
- Make sure that all normalized fields have the correct type.
234+
To make sure that your parser produces a valid schema, use the ASIM schema tester by running the following query in the Microsoft Sentinel **Logs** page:
232235

233-
- Make sure that fields with logical types are populated only with permitted values. For example, an IP address field is always populated with a valid IP address, and that an enumerated field always gets permitted values.
236+
```KQL
237+
<parser name> | getschema | invoke ASimSchemaTester('<schema>')
238+
```
234239

235-
The ASIM parser testing tool tests for mandatory fields and correct field types.
240+
Handle the results as follows:
241+
242+
| Message | Action |
243+
| ------- | ------ |
244+
| **(0) Error: Missing mandatory field [\<Field\>]** | Add this field to your parser. In many cases, this would be a derived value or a constant value, and not a field already available from the source. |
245+
| **(0) Error: Missing mandatory alias [\<Field\>] aliasing existing column [\<Field\>]** | Add this alias to your parser. |
246+
| **(0) Error: Missing mandatory alias [\<Field\>] aliasing missing column [\<Field\>]** | This error accompanies a similar error for the aliased field. Correct the aliased field error and add this alias to your parser. |
247+
| **(0) Error: Missing recommended alias [\<Field\>] aliasing existing column [\<Field\>]** | Add this alias to your parser. |
248+
| **(0) Error: Missing optional alias [\<Field\>] aliasing existing column [\<Field\>]** | Add this alias to your parser. |
249+
| **(0) Error: type mismatch for field [\<Field\>]. It is currently [\<Type\>] and should be [\<Type\>]** | Make sure that the type of normalized field is correct, usually by using a [conversion function](/azure/data-explorer/kusto/query/scalarfunctions#conversion-functions) such as `tostring`. |
250+
| **(1) Warning: Missing recommended field [\<Field\>]** | Consider adding this field to your parser. |
251+
| **(1) Warning: Missing recommended alias [\<Field\>] aliasing non-existent column [\<Field\>]** | If you add the aliased field to the parser, make sure to add this alias as well. |
252+
| **(1) Warning: Missing optional alias [\<Field\>] aliasing non-existent column [\<Field\>]** | If you add the aliased field to the parser, make sure to add this alias as well. |
253+
| **(2) Info: Missing optional field [\<Field\>]** | While optional fields are often missing, it is worth reviewing the list to determine if any of the optional fields can be mapped from the source. |
254+
| **(2) Info: extra unnormalized field [\<Field\>]** | While unnormalized fields are valid, it is worth reviewing the list to determine if any of the unnormalized values can be mapped to an optional field. |
255+
|||
236256

237-
### Optional tests
257+
> [!NOTE]
258+
> Errors will prevent content using the parser from working correctly. Warnings will not prevent content from working, but may reduce the quality of the results.
259+
>
260+
261+
### Validate the output values
262+
263+
To make sure that your parser produces valid values, use the ASIM data tester by running the following query in the Microsoft Sentinel **Logs** page:
264+
265+
```KQL
266+
<parser name> | limit <X> | invoke ASimDataTester('<schema>')
267+
```
268+
269+
This test is resource intensive and may not work on your entire data set. Set X to the largest number for which the query will not timeout, or set the time range for the query using the time range picker.
270+
271+
Handle the results as follows:
272+
273+
| Message | Action |
274+
| ------- | ------ |
275+
| **(0) Error: type mismatch for column [\<Field\>]. It is currently [\<Type\>] and should be [\<Type\>]** | Make sure that the type of normalized field is correct, usually by using a [conversion function](/azure/data-explorer/kusto/query/scalarfunctions#conversion-functions) such as `tostring`. |
276+
| **(0) Error: Invalid value(s) (up to 10 listed) for field [\<Field\>] of type [\<Logical Type\>]** | Make sure that the parser maps the correct source field to the output field. If mapped correctly, update the parser to transform the source value to the correct type, value or format. Refer to the [list of logical types](normalization-about-schemas.md#logical-types) for more information on the correct values and formats for each logical type. <br><br>Note that the testing tool lists only a sample of 10 invalid values. |
277+
| **(0) Error: Empty value in mandatory field [\<Field\>]** | Mandatory fields should be populated, not just defined. Check whether the field can be populated from other sources for records for which the current source is empty. |
278+
| **(1) Error: Empty value in recommended field [\<Field\>]** | Recommended fields should usually be populated. Check whether the field can be populated from other sources for records for which the current source is empty. |
279+
| **(1) Error: Empty value in alias [\<Field\>]** | Check whether the aliased field is mandatory or recommended, and if so, whether it can be populated from other sources. |
280+
|||
281+
282+
283+
> [!NOTE]
284+
> Errors will prevent content using the parser from working correctly. Warnings will not prevent content from working, but may reduce the quality of the results.
285+
>
286+
287+
288+
### Check for incomplete parsing
238289

239290
Check that fields are populated:
240291
- A field that is rarely or never populated may indicate incorrect parsing.
@@ -256,31 +307,6 @@ You can use the following query to test how sparsely populated each field is.
256307

257308
Set the time period to the longest that performance will allow.
258309

259-
### Using the ASIM parser testing tool
260-
261-
Test the parser using the ASIM parser testing tool to find missing mandatory or recommended fields and fields with an incorrect type:
262-
263-
1. [Deploy the ASIM testing tool]() to a Microsoft Sentinel workspace where your parser is deployed and works.
264-
265-
1. Run the following query in the Microsoft Sentinel **Logs** page:
266-
267-
```KQL
268-
<parser name> | getschema | invoke ASimSchemaTester('<schema>')
269-
```
270-
271-
Handle the results as follows:
272-
273-
| Message | Action |
274-
| ------- | ------ |
275-
| **(0) Error: Missing mandatory field [\<Field\>]** | Add this field to your parser. In many cases, this would be a derived value or a constant value, and not a field already available from the source. |
276-
| **(0) Error: type mismatch for field [\<Field\>]. It is currently [\<Type\>] and should be [\<Type\>]** | Make sure that the type of normalized field is correct, usually by using a [conversion function](/azure/data-explorer/kusto/query/scalarfunctions#conversion-functions) such as `tostring`. |
277-
| **(1) Warning: Missing recommended field [\<Field\>]** | Consider adding this field to your parser. |
278-
| **(1) Warning: Missing alias [\<Field\>]** | Check if the field the alias refers to exists and if so, add the alias. |
279-
| **(2) Info: Missing optional field [\<Field\>]** | While optional fields are often missing, it is worth reviewing the list to determine if any of the optional fields can be mapped from the source. |
280-
| **(2) Info: extra unnormalized field [\<Field\>]** | While unnormalized fields are valid, it is worth reviewing the list to determine if any of the unnormalized values can be mapped to an optional field. |
281-
|||
282-
283-
284310
## <a name="next-steps"></a>Next steps
285311

286312
This article discusses developing ASIM parsers.

0 commit comments

Comments
 (0)