bloblang

Executes a Bloblang mapping on messages.

# Config fields, showing default values
bloblang: ""

Bloblang is a powerful language that enables a wide range of mapping, transformation and filtering tasks. For more information check out the docs.

Examples#

Given JSON documents containing an array of fans:

{
"id":"foo",
"description":"a show about foo",
"fans":[
{"name":"bev","obsession":0.57},
{"name":"grace","obsession":0.21},
{"name":"ali","obsession":0.89},
{"name":"vic","obsession":0.43}
]
}

We can reduce the fans to only those with an obsession score above 0.5, giving us:

{
"id":"foo",
"description":"a show about foo",
"fans":[
{"name":"bev","obsession":0.57},
{"name":"ali","obsession":0.89}
]
}

With the following config:

pipeline:
processors:
- bloblang: |
root = this
fans = fans.map_each(match {
this.obsession > 0.5 => this
_ => deleted()
})

Error Handling#

Bloblang mappings can fail, in which case the message remains unchanged, errors are logged, and the message is flagged as having failed, allowing you to use standard processor error handling patterns.

However, Bloblang itself also provides powerful ways of ensuring your mappings do not fail by specifying desired fallback behaviour, which you can read about in this section.