Skip to main content
Version: 1.4.0

Random String

Text Processing Data Generation

Synopsis

Generates random strings with specified length and character sets.

Schema

- random_string:
field: <ident>
length: <integer>
charset: <string>
target_field: <string>
prefix: <string>
suffix: <string>
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:

FieldRequiredDefaultDescription
fieldY-Target field to store the generated random string
lengthY-Length of the random string to generate
charsetNalphanumericCharacter set: alphanumeric, alpha, numeric, hex, custom
target_fieldNSame as fieldTarget field to store result
prefixN-Static prefix to prepend to random string
suffixN-Static suffix to append to random string
descriptionN-Explanatory note
ifN-Condition to run
ignore_failureNfalseContinue processing if generation fails
ignore_missingNfalseSkip processing if referenced field doesn't exist
on_failureN-See Handling Failures
on_successN-See Handling Success
tagN-Identifier

Details

Generates cryptographically secure random strings using specified character sets and length requirements. This processor is useful for creating unique identifiers, tokens, passwords, or test data.

The processor supports various predefined character sets and allows custom character sets for specific requirements. Generated strings are suitable for security-sensitive applications.

note

The processor uses cryptographically secure random number generation to ensure unpredictability of the generated strings. This makes them suitable for security tokens and identifiers.

The prefix and suffix options allow you to add static text before and after the random portion, which is useful for creating formatted identifiers or tokens with specific patterns.

warning

Generating very long random strings (>10000 characters) may impact performance. Consider using reasonable lengths for production workloads.

Examples

Basic Random String

Generating a 10-character alphanumeric string...

{
"user_id": "existing_user"
}
- random_string:
field: session_id
length: 10
charset: alphanumeric

adds random session identifier:

{
"user_id": "existing_user",
"session_id": "A7k9Mq2Px5"
}

Hexadecimal Token

Creating a hexadecimal token...

{
"request_data": "sample"
}
- random_string:
field: token
length: 16
charset: hex
target_field: auth_token

generates hex token:

{
"request_data": "sample",
"auth_token": "a1b2c3d4e5f67890"
}

Formatted Identifier

Creating formatted ID with prefix/suffix...

{
"event_type": "login"
}
- random_string:
field: transaction_id
length: 8
charset: alphanumeric
prefix: "TXN-"
suffix: "-2024"

creates formatted transaction ID:

{
"event_type": "login",
"transaction_id": "TXN-K3m7Qp9R-2024"
}

Numeric PIN

Generating numeric PIN code...

{
"user_request": "reset_password"
}
- random_string:
field: verification_pin
length: 6
charset: numeric

creates numeric verification code:

{
"user_request": "reset_password",
"verification_pin": "847329"
}

Alphabetic Code

Creating alphabetic reference code...

{
"ticket_type": "support"
}
- random_string:
field: reference_code
length: 5
charset: alpha
prefix: "REF-"

generates alphabetic reference:

{
"ticket_type": "support",
"reference_code": "REF-KMPQX"
}