Random String
Synopsis
Generates random strings with specified length and character sets.
Schema
- random_string:
target_field: <ident>
length: <numeric>
charset: <enum>
custom_chars: <string>
description: <text>
if: <script>
ignore_failure: <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 string. There is no default: an empty value fails with target_field is required |
length | Y | - | Length of the string to generate. Must be greater than 0 |
charset | N | alphanumeric | Character set: alphanumeric, alpha (or alphabetic), numeric (or numbers, digits), hex (or hexadecimal), base64, or custom |
custom_chars | Y* | - | The characters to draw from. Required when charset is custom, unused otherwise |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | Continue processing if generation fails |
on_failure | N | - | See Handling Failures |
on_success | N | - | See Handling Success |
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 |
* = Required only when charset is custom; the processor then fails with custom_chars must be specified when charset is 'custom' if it is absent.
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.
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.
Generating very long random strings (>10000 characters) may impact performance. Consider using reasonable lengths for production workloads.
Details
The processor takes no input field. It generates a value and writes it, so there is nothing to read and no ignore_missing.
There is no prefix or suffix. To wrap the generated value, follow this processor with a Set or Append step that builds the final string from it.
Each charset name has aliases: alpha also accepts alphabetic, numeric also accepts numbers and digits, and hex also accepts hexadecimal. An unrecognized name is an error rather than a silent fallback.
Examples
Basic Random String
Generating an alphanumeric identifier... | |
with the default charset: | |
Hexadecimal Token
A hexadecimal string of a fixed width... | |
drawn from 0-9 and a-f: | |
A Prefixed Identifier
There is no | |
with the scratch field removed once it has been used: | |
A Custom Alphabet
| |
here excluding the characters that are easily misread aloud: | |
Base64 Alphabet
The | |
note this is a random string OF those characters, not an encoding of anything: | |