Decode
less than a minute
The Decode converter decodes an encoded field.
Edge Delta Extension Available: EDXEncode provides the complementary encoding function to convert strings back to byte arrays, which is essential for working with the
bodyfield.
Syntax: Decode(value, encoding)
- value: the bracket notation location of the encoded field
- encoding: the encoding type from the IANA encoding index
Input
{
"_type": "log",
"body": "Deployment issue",
"resource": {
"ed.conf.id": "123456789",
"ed.domain": "pipeline",
"ed.org.id": "987654321",
"ed.source.name": "__ed_dummy_test_input",
"ed.source.type": "memory_input",
"ed.tag": "loggen",
"host.ip": "10.0.0.1",
"host.name": "c2ltcGxlLWhvc3Q=",
"service.name": "ed-tester",
"src_type": "memory_input"
},
"timestamp": 1733442011940
}
Statement
set(resource["decoded_host.name"], Decode(resource["host.name"], "base64"))
Output
{
"_type": "log",
"body": "Deployment issue",
"resource": {
"decoded_host.name": "simple-host",
"ed.conf.id": "123456789",
"ed.domain": "pipeline",
"ed.org.id": "987654321",
"ed.source.name": "__ed_dummy_test_input",
"ed.source.type": "memory_input",
"ed.tag": "loggen",
"host.ip": "10.0.0.1",
"host.name": "c2ltcGxlLWhvc3Q=",
"service.name": "ed-tester",
"src_type": "memory_input"
},
"timestamp": 1733442074816
}
The base64 encoded string c2ltcGxlLWhvc3Q= was decoded to simple-host and stored in the decoded_host.name field.