---
title: "Structure Parser"
description: "structure input events into well-defined TenXObjects"
source: "https://github.com/log-10x/modules/tree/main/pipelines/run/units/transform/structure/unit.yaml"
icon: "material/shape-plus-outline"

---
Structure events read from [input](https://doc.log10x.com/run/input/stream/ "Read events from a variety of sources to transform into TenXObjects") using [Symbol libraries](https://doc.log10x.com/run/symbol "Import symbol libraries from files to transform events into well-defined TenXObjects") into typed [TenXObjects](https://doc.log10x.com/api/js/#TenXObject "Provide structured, reflective access to log/trace events read from input(s).").

The structuring process breaks down each input event into its discrete values and classifies each value as either a [variable](#variables), [symbols](#symbol) or [delimiter](#delimiters) using information from the symbol library. An event's _structure_ is defined by its sequence of symbols and delimiter values (excluding variables).

Events sharing the same structure are assigned an `TenXTemplate` (i.e. _hidden class_) as a joint schema, similar to a programmatic class that defines the structure of its instances.

## :material-butterfly-outline: Process

The transform process executes the following steps for each [input](https://doc.log10x.com/run/input/ "Read events into the pipeline from local and remote sources") event:

1. Identify the event's matching TenXTemplate type (i.e., _hidden class_) using loaded [symbol libraries](https://doc.log10x.com/compile/link/#symbol-library).

2. If a new cached TenXTemplate is generated on-the-fly for the event:
   
    - Parse [timestamp](https://doc.log10x.com/run/transform/timestamp/ "Extract alphanumeric and epoch timestamp values from input events") structures.
    - Extract [KV/JSON field](https://doc.log10x.com/run/transform/fields/ "Scan TenXTemplates for JSON and KV fields") structures.
    - Calculate [symbol information](https://doc.log10x.com/run/transform/symbol/ "Select the source code/binary executable origin of TenXTemplate symbol values") (lazy).

3. [Initialize](https://doc.log10x.com/run/transform/script/object/ "Initialize TenXObject instances at runtime using JavaScript.") the instance using custom JavaScript constructors.

4. [Enrich](https://doc.log10x.com/run/initialize/ "Enrich TenXObjects with additional context") with calculated fields (e.g., GeoIP) using configured modules.

5. [Group](https://doc.log10x.com/run/transform/group/ "Group and sequence TenXObjects") instances together into composite units (e.g., stack traces, multi-line JSON) for aggregation and encoding as a single logical unit.

## :material-format-list-group: Members

Each TenXObject instance contains variables unique to its instance as members and a reference to its TenXTemplate (i.e., [_hidden class_](https://v8.dev/docs/hidden-classes){target="\_blank"}). Symbol values serve as _static_ class members shared across all instances of a logical app/infra event.

Each symbol links to its source code/binary [origin](https://doc.log10x.com/run/transform/symbol/ "Select the source code/binary executable origin of TenXTemplate symbol values") and its [context](https://doc.log10x.com/run/transform/symbol/#contexts) within the file (e.g., class, field, enum, printout).

### :material-variable: **`Variables`**

High-cardinality values specific to the current event. These include:

- Alphanumeric values (e.g., EDC8116I)
- Formatted/epoch timestamps (e.g., 2022-04-29T18:52:58.114201Z, 1719928783)
- Host addresses (e.g., 10.10.34.11:9000)
- Span IDs (e.g., 0x051581bf3cb55c13)

### :material-alphabetical-variant: **`Symbols`**

Low-cardinality values extracted from source code and binary artifacts at compile-time and stored in a target [Symbol library](https://doc.log10x.com/run/symbol "Import symbol libraries from files to transform events into well-defined TenXObjects"). These include:

- Class names (e.g., MyClient, MyServer)
- Function/method names (e.g., info, warn)
- Enum literals (e.g., STATUS, ERROR, OK)
- String formats (e.g., "could not connect to {}")
- JSON/XML field names (e.g. attributes, trace\_id)
- Win/Nix executable strings (e.g., 'sudo, 'connection refused').

### :material-comma: **`Delimiters`**

Single character values specified via the [tokenDelims](#tokendelims "token delimiters") argument.

## :material-menu: Options

Specify the options below to [configure](/config "configure") the Structure parser:

|Name|Description|
|---|---|
|[tokenDelims](#tokendelims "token delimiters")|Token delimiters|

### :material-menu-right-outline:**`tokenDelims`**

Token delimiters.

|Type|Default|
|---|---|
|String|\<\>\|. \]\[:-+/\*=\\\\,{}\_();'\\"$\\t\\n@|

Defines which characters break a string of event characters into tokens to classify as symbols or variables.


<br/>:material-github: This module is defined in [structure/unit.yaml](https://github.com/log-10x/modules/tree/main/pipelines/run/units/transform/structure/unit.yaml "structure/unit.yaml"){target="\_blank"}.

