Skip to main content
During the ingestion phase, after parsing your data, Chronosphere Observability Platform applies your preferred field normalization rules to populate predefined keys such as service, severity, and timestamp. This mapping provides consistency in your data, and optimizes querying in Logs Explorer. After applying these mappings, Observability Platform applies control rules, and then stores your log data. In addition to these mappings, you can apply custom field mappings to normalize log data, such as normalizing values from several fields that all relate to different environments. See Examples for examples of how you can use custom field mappings. Custom field mappings are applied after log data is ingested, but before Observability Platform stores it. To indicate nesting within a source field, use a dot (.). For example, if your logs are in a format like {"resource": {"labels": {"project_id": "..."}}}, then enter resource.labels.project_id. If your logs already use dot notation, such as {"resource.labels.project_id": "..."}, enclose the selector in double quotes and brackets like ["resource.labels.project_id"]. See target nested or flat fields with dot notation for additional examples.

View custom field mappings

Select from the following methods to view custom field mappings.
To view custom field mappings:
  1. In the navigation menu, click Go to Admin and then select Control > Logs Ingest. All field mappings display in the Field normalization section, including both predefined and custom field mappings.
  2. Choose which custom field mappings to view:
    • To view an individual custom field mapping, click it in the list to open the configuration in the Edit field mapping drawer.
    • To view the code definition for all configured custom field mappings, click the Code config tab.

Create custom field mappings

Use one of the following methods to create custom field mappings.
Define the custom field mapping definition in Observability Platform, and then use the Code Config tool to apply the definition.
  1. In the navigation menu, click Go to Admin and then select Control > Logs Ingest.
  2. In the Field normalization section, click Create.
  3. In the Custom field name field, enter the custom field name to map data to, such as environment, region, or userID.
  4. In the Mapped fields section, in the Source field name field, enter a source field name from your log data to map to the custom field you’re creating. Fields are matched in priority order. To add more fields, click Add field mapping and then enter another source field.
    Use a dot (.) to indicate nesting within a field. For example, if your logs are in a format like {"resource": {"labels": {"project_id": "..."}}}, then enter resource.labels.project_id.If your logs already use dot notation, such as {"resource.labels.project_id"}, enclose the selector in double quotes and brackets like ["resource.labels.project_id"].
  5. Optional: In the Default value field, enter a default value as the mapping if the custom field contains no values.
  6. Optional: Select either Regex or Value map as the normalization mode.
    • Regex: Enter a regular expression pattern to extract and normalize values, such as for removing extraneous data. For example, use the following regular expression to remove prefixes and suffixes from any environments including production in the name:
    • Value map: Enter key:value pairs to map additional metadata within your custom field. For example, map "warn" to "Warning" and "err" to "Error" for different severity types. To add more value mappings, click Add value mapping and then define the value mapping.
  7. Click Save to save the custom field mapping definition.
  8. Click the Code config tab and use the Code Config tool to apply your changes.

Edit custom field mappings

When creating or editing a custom field mapping, you can use the Code Config tool to view code representations of a field mapping. The displayed code also responds to changes you make in the Visual editor tab. Select from the following methods to edit custom field mappings. After selecting a field mapping to edit, you can change the field mappings order. Fields are matched in priority order, so an order of 1 has higher precedence over an order of 6.
  1. In the navigation menu, click Go to Admin and then select Control > Logs Ingest.
  2. In the Field normalization section, click the custom field mapping you want to edit.
  3. In the Edit field mapping drawer, change your custom field mapping.
  4. To reorder field mappings, drag and drop them to change the order.
  5. Click Save. Observability Platform saves changes to your custom field mapping.
  6. Click the Code config tab and use the Code Config tool to apply your changes.

Delete custom field mappings

Select from one of the following methods to delete custom field mappings.
  1. In the navigation menu, click Go to Admin and then select Control > Logs Ingest.
  2. In the Edit field mapping drawer, in the row of the field mapping you want to delete, click the trash can icon.
  3. Click Save to save your changes.
  4. Click the Code config tab and use the Code Config tool to apply your changes.
Observability Platform deletes your custom field mapping.

Target nested or flat fields with dot notation

The source selectors for custom field mappings support dot notation to read values from fields inside nested structures. How Observability Platform interprets a selector depends on whether you enclose the segments in brackets in double quotes:
  • An unbracketed dot splits the selector into path segments, which traverses nested fields. A source of metadata.code reads a code field nested inside a metadata object.
  • A bracket-quoted segment such as ["metadata.code"] treats the quoted string as a single, literal field name that contains a dot. This reads a flat field named metadata.code instead of a nested structure.
Consider a custom field mapping that populates a status_code target from a source field. To read from a nested field, set the source selector to metadata.code:
This selector reads the value from the nested code field:
To read from a single flat field whose name contains a dot, enclose the source selector in double quotes and brackets:
This selector reads the value from one literal field name:

Examples

The following examples show common custom_field_normalization patterns. Each object is an element of the custom_field_normalization array.

Standardize and enrich data

Normalize values from several fields that all relate to different environments, such as environment and region. You can then add optional mappings for individual environments, such as mapping dev to development.

Consolidate values from multiple fields

Map a single region field from whichever source field is present, checking region first and then datacenter. If neither contains a value, apply a default value.

Standardize values with a value map

Normalize inconsistent HTTP status codes into a smaller set of status classes, and label anything unmatched as unknown.

Extract a value with a regular expression

Use sanitize_patterns to extract a substring from a larger field. Each pattern must contain exactly one capturing group, and Observability Platform uses that group as the result. This example extracts an uppercase log level from a free-form message field.

Map a value from a nested field

Use dot notation to read a value from a nested structure, such as user.id inside {"user": {"id": "..."}}. Sources are still matched in priority order.

Map a value from a flat field that contains dots

If a source field name already contains dots, bracket-quote the selector so Observability Platform treats it as one literal field name instead of a nested path.