Monad Transforms Reference
Transforms are the processing engine of Monad pipelines. They filter, normalize, enrich, and reshape data between input and output.
Technical Foundation
Monad transforms use GJSON and SJSON packages for JSON traversal and manipulation.
-
GJSON - Query/read JSON paths
-
SJSON - Modify/write JSON values
Test GJSON paths at: gjson.dev
Transform Types
Add
Add a new key-value pair to the record.
{
"operation": "add",
"arguments": {
"key": "source_system",
"value": "ise-radius"
}
}
Input:
{"user": "jdoe", "result": "pass"}
Output:
{"user": "jdoe", "result": "pass", "source_system": "ise-radius"}
Timestamp
Append current UTC time in specified format.
{
"operation": "timestamp",
"arguments": {
"key": "ingestion_time",
"format": "rfc3339"
}
}
Supported Formats:
| Format | Example |
|---|---|
|
|
|
|
|
|
|
|
|
|
Flatten
Flatten a specific nested map or array into flat key-value pairs.
{
"operation": "flatten",
"arguments": {
"key": "nested_data",
"base": "flat",
"delimiter": "_"
}
}
Input:
{
"nested_data": {
"level1": {
"level2": "value"
}
}
}
Output:
{
"flat_level1_level2": "value"
}
Flatten All
Flatten the entire JSON document into a single-level structure.
{
"operation": "flatten_all",
"arguments": {
"delimiter": "_"
}
}
-
Nested objects:
address.city→address_city -
Arrays:
contacts[0].type→contacts_0_type -
Null values preserved
-
Applied to entire document
For (Loop)
Apply transformations to each element of an array.
{
"operation": "for",
"arguments": {
"key": "items",
"transforms": [
{
"operation": "add",
"arguments": {"key": "processed", "value": true}
},
{
"operation": "rename",
"arguments": {"from": "name", "to": "item_name"}
}
]
}
}
-
Transforms execute sequentially on each array element
-
Array structure preserved
-
Useful for normalizing nested collections
JQ Transform
Full jq query syntax for complex data manipulation.
{
"operation": "jq",
"arguments": {
"query": ".user | ascii_downcase",
"key": "normalized_user"
}
}
Two Output Modes
Direct Output (no key): Query result becomes entire output
{
"operation": "jq",
"arguments": {
"query": "{user: .username, ip: .source_ip}"
}
}
Key Storage (with key): Result stored at specified path
{
"operation": "jq",
"arguments": {
"query": ".events | length",
"key": "event_count"
}
}
Common jq Operations
| Operation | Example |
|---|---|
Filter |
|
Reshape |
|
Delete fields |
|
Array ops |
|
String ops |
|
Math |
|
|
Trial Limitation: jq transforms may require full license. Trial accounts limited to GJSON-based transforms. |
Rename Key
Rename a field.
{
"operation": "rename",
"arguments": {
"from": "src_ip",
"to": "source_ip"
}
}
Drop Key
Remove a field from the record.
{
"operation": "drop_key",
"arguments": {
"key": "debug_info"
}
}
Drop Record Where Value Equal
Filter out (discard) records matching a condition.
{
"operation": "drop_record_where_value_equal",
"arguments": {
"key": "event_type",
"value": "heartbeat"
}
}
Use this to filter out noise before it reaches outputs.
Convert Timestamp
Convert existing timestamp to different format.
{
"operation": "convert_timestamp",
"arguments": {
"key": "event_time",
"from_format": "unix",
"to_format": "rfc3339"
}
}
Mutate Value Where Key Equal
Conditionally modify field values.
{
"operation": "mutate_value_where_key_equal",
"arguments": {
"key": "status",
"match_value": "PASS",
"new_value": "success"
}
}
Mutate Type
Change the data type of a field.
{
"operation": "mutate_type",
"arguments": {
"key": "port",
"type": "integer"
}
}
Add Identifier
Add a unique identifier (UUID) to each record.
{
"operation": "add_identifier",
"arguments": {
"key": "record_id"
}
}
Duplicate Key Value to Key
Copy a value to create a new field.
{
"operation": "duplicate_key_value_to_key",
"arguments": {
"source_key": "user",
"destination_key": "original_user"
}
}
GJSON Path Syntax
Used in transform key arguments and routing conditions.
Basic Access
| Path | Description |
|---|---|
|
Direct field access |
|
Nested field |
|
Array index (0-based) |
|
Array length |
Wildcards and Queries
| Path | Description |
|---|---|
|
All |
|
Filter array elements |
|
Filter then extract |
Comparison Operators
| Operator | Meaning |
|---|---|
|
Equal |
|
Not equal |
|
Less than |
|
Less than or equal |
|
Greater than |
|
Greater than or equal |
|
Pattern match (like) |
Transform Chaining
Transforms execute in pipeline order. Common patterns:
Normalize → Filter → Enrich
-
Flatten - Normalize nested structure
-
Rename - Standardize field names
-
Drop Record - Filter out noise
-
Timestamp - Add ingestion time
-
Add - Tag with source system
ISE Log Processing Example
[
{"operation": "flatten_all", "arguments": {"delimiter": "_"}},
{"operation": "rename", "arguments": {"from": "UserName", "to": "user"}},
{"operation": "rename", "arguments": {"from": "NAS-IP-Address", "to": "switch_ip"}},
{"operation": "drop_record_where_value_equal", "arguments": {"key": "event_type", "value": "accounting_interim"}},
{"operation": "timestamp", "arguments": {"key": "monad_ingest_time", "format": "rfc3339"}},
{"operation": "add", "arguments": {"key": "log_source", "value": "ise-radius"}}
]