Snowflake
Synopsis
Generates a unique Snowflake ID and stores it in a target field. The ID is generated from the node clock and needs no input field.
Schema
- snowflake:
target_field: <ident>
description: <text>
if: <script>
ignore_failure: <boolean>
ignore_missing: <boolean>
on_failure: <processor[]>
on_success: <processor[]>
tag: <string>
Configuration
The following fields are used to define the processor:
| Field | Required | Default | Description |
|---|---|---|---|
target_field | Y | - | Field to store the generated Snowflake ID. There is no default: an empty value fails with target_field cannot be empty |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | Continue processing if ID generation fails |
ignore_missing | N | false | Skip if field doesn't exist |
on_failure | N | - | Error handling processors |
on_success | N | - | Success handling processors |
tag | N | - | Identifier |
disabled | N | false | When true, the processor is skipped and the event continues to the next one. Lets you take a processor out of the path without removing its configuration |
Details
Generates a unique Snowflake ID and stores it in the specified target field. Snowflake IDs are 64-bit unique identifiers designed for distributed systems, combining a timestamp, worker ID, and sequence number to create globally unique values that are also roughly time-sortable.
Snowflake IDs are 64-bit integers typically represented as strings. They are time-sortable (IDs created later will generally be larger than IDs created earlier), which makes them useful for chronological sorting in databases.
The processor is useful for assigning unique identifiers to log entries, tracking events across distributed systems, and creating correlation IDs without coordination between nodes.
While Snowflake IDs are designed to be unique across distributed systems, they should not be used for cryptographic purposes. If you need IDs for security-sensitive operations, consider using a dedicated cryptographic random generator.
Examples
Basic
Generating a basic Snowflake ID... | |
adds a unique identifier: | |
Nested Fields
Generating ID in a nested structure... | |
creates nested fields automatically: | |
Correlation
Generating correlation ID for distributed tracing... | |
adds tracking ID only if not already present: | |
Multi-ID
Generating multiple IDs for different purposes... | |
creates multiple unique identifiers: | |