Reference: Source field mapping options
In addition to the default field mappings for each custom source, you can configure additional field mappings. Each field mapping must specify how to map attributes in the source to attributes in the Asset database. Use this reference to understand the available options when you configure field mappings.
Map additional fields for a source
In addition to the default field mappings for each custom source, you can configure custom field mappings.
Before you begin
-
You must first create the source before you configure additional field mappings.
-
To map a source field to an Asset entity, the field must exist in the source and the entity must exist in Asset. For more information about how to configure custom entities and attributes in Asset, see Configure additional Tanium entities and attributes.
-
To map an array of values in the source schema to an entity in Asset, use a multiple-row Asset entity. To map a single field in the source schema, use a single-row Asset entity. You must have a role with the Asset Configuration Item write permission to edit sources. Users assigned the Asset Operator and Asset Administrator reserved roles have this permission.
-
You must have access to the field schema from the source, and you should understand how to navigate the schema using dot-notation syntax. For more information about how to use dot-notation when mapping fields, see Dot-notation syntax.
Steps
-
From the Main menu, go to .
-
In the row of the source that you want to edit, click Edit
.
-
Go to the Field Mappings section and click Add Entity Field Mapping.
The Field Mappings section contains the default field mappings for the source in addition to any custom field mappings. The section only appears when you edit the source.
-
From the Add Entity Field Mapping dialog, select the Asset entity to which you want to map a field from the source.
-
If you selected an entity that contains multiple rows per endpoint, enter the path to the array in the source schema in the Source Array Path field, and then select the Attribute to Edit.
Tip: To reset any configuration settings for Source and Convert Operations, click Deletenext to Attribute to Edit.
-
To map the value in the schema to the Asset attribute, enter the path to the field in the schema in the Source field and ensure Path is selected. If you selected an entity with multiple rows per endpoint, you only need to enter the path starting from the path specified in the Source Array Path field. Specify paths in dot-notation format. For more information, see Dot-notation syntax.
Note: You can also choose to map a constant value to the Asset attribute. Enter the value in the Source field and then select Static Value. -
For the Source field, choose one of the following:
-
To map the value in the schema to the Asset attribute, select Path and then enter the path to the field in the schema in the Source field. If you selected an entity with multiple rows per endpoint, you only need to enter the path starting from the path specified in the Source Array Path field.
-
To map a constant value to the Asset attribute, select Static Value and enter the value in the Source field.
-
-
(Optional) To augment the data from the source, add convert operations.
Note: The option to add convert operations is not available if you select Static Value for the Source field.-
Click Add Convert Operation.
-
Select the type of convert operation and then enter a value for the operation.
Convert Operation
Description
Append
Enter a value to append to the data.
Array Length
When the field that you specified in the Source field is an array, returns the length of the array
Lowercase
Convert all characters in the data to lowercase.
Replace
Match a regular expression in the data and then enter the replacement value.
Prefix
Enter a value to prepend to the data.
For more information about these convert operations, see Convert operations.
-
Repeat to add any additional convert operations.
-
(Optional) If you add multiple operations, drag the operations to change the order in which the operations occur.
-
-
When finished, click Save Changes.
The field mapping is immediately applied to the source; you do not need to save the source to save the new field mapping.
What to do next
Import the source to verify the field mapping performs as expected. For more information, see Test field mappings.
Convert operations
The following convert operations are available when you configure additional field mapping. Convert operations are only available when the Source value contains a path. For more information, see Map additional fields for a source.
- Append
-
Enter a value to append to the data.
For example, if you select to append GB to the data (with a preceding space), a value of 10 is converted to 10 GB.
- Array Length
-
Return the length of the array specified in the Source field.
For example, consider the following schema from the source:
JSON{ "level1": { "level2": [ { "value1": "something" }, { "value2": "something" } } } }If you select to return the array length of the level1.level2 array, the data is converted to 2.
Note: If the field that you specify is not an array, the data converts to null. - Lowercase
-
Convert all characters in the data to lowercase.
For example, if you select the Lowercase convert operation, a value of ABC123def789GHI is converted to abc123def789ghi.
- Replace
-
Match a string or regular expression in the data with a replacement value.
For example, if you enter a Match value of
([^\\s]+).*(anything other than a space character at the start of a string) and select a Replace value of$1, a value of My Company is converted to My.Tip: The replace operation accepts the same regular expressions as the JavaScript replace function. For more information about acceptable patterns, see Specifying a string as the replacement. - Prefix
-
Enter a value to prepend to the data.
For example, if you select to prepend SN_ to the data, a value of 123456789 is converted to SN_123456789.
Dot-notation syntax
Paths use standard JavaScript dot-notation syntax to navigate through a JSON object. Consider the following JSON example:
{
"level1": {
"level2": {
"value": "something",
}
}
}
To map the data in "value" the path would be level1.level2.value and the returned value is "something".
The path also supports arrays, where bracket parentheses index within the array.
{
"level1": [
{
"value": "something1",
},
{
"value": "something2".
}
]
}
Use the zero-based index within the array for mapping. For example, level1[0].value maps to "something1".
Arrays also support negative indexes to index from the bottom of the array. For example, level1[-1].value maps to "something2".
Test field mappings
To view field mappings for a source, you can manually import the source from the Schedules page or wait until the next scheduled import.
To manually import the source, perform the following:
-
From the Main menu, go to .
-
In the row of the source that you want to import on the Import Schedules tab, click Run Now
.