base64.encode
Encode a field to base64.
Description
The processor will encode the value of the target field to base64 and store the
result in the target field. It is not allowed to encode the .Position
field.
If the provided field doesn't exist, the processor will create that field and
assign its value.
Configuration parameters
Name | Type | Default | Description |
---|---|---|---|
field | string | null | Field is a reference to the target field. Note that it is not allowed to
base64 encode the For more information about the format, see Referencing fields. |
Examples
Encode record key to base64
TThis example takes a record containing raw data in
.Key
and converts it into a base64 encoded string.
Configuration parameters
Name | Value |
---|---|
field | .Key |
Record difference
Before | After | ||||
1 | { | 1 | { | ||
2 | "position": "dGVzdC1wb3NpdGlvbg==", | 2 | "position": "dGVzdC1wb3NpdGlvbg==", | ||
3 | "operation": "create", | 3 | "operation": "create", | ||
4 | "metadata": { | 4 | "metadata": { | ||
5 | "key1": "val1" | 5 | "key1": "val1" | ||
6 | }, | 6 | }, | ||
7 | - | "key": "test-key", | 7 | + | "key": "dGVzdC1rZXk=", |
8 | "payload": { | 8 | "payload": { | ||
9 | "before": null, | 9 | "before": null, | ||
10 | "after": { | 10 | "after": { | ||
11 | "foo": "bar" | 11 | "foo": "bar" | ||
12 | } | 12 | } | ||
13 | } | 13 | } | ||
14 | } | 14 | } |
Encode nested value to base64
This example takes a record containing a string in
.Payload.Before.foo
and converts it into a base64 encoded string.
Configuration parameters
Name | Value |
---|---|
field | .Payload.After.foo |
Record difference
Before | After | ||||
1 | { | 1 | { | ||
2 | "position": "dGVzdC1wb3NpdGlvbg==", | 2 | "position": "dGVzdC1wb3NpdGlvbg==", | ||
3 | "operation": "create", | 3 | "operation": "create", | ||
4 | "metadata": { | 4 | "metadata": { | ||
5 | "key1": "val1" | 5 | "key1": "val1" | ||
6 | }, | 6 | }, | ||
7 | "key": "test-key", | 7 | "key": "test-key", | ||
8 | "payload": { | 8 | "payload": { | ||
9 | "before": null, | 9 | "before": null, | ||
10 | "after": { | 10 | "after": { | ||
11 | - | "foo": "bar" | 11 | + | "foo": "YmFy" |
12 | } | 12 | } | ||
13 | } | 13 | } | ||
14 | } | 14 | } |