base64decode Formula function
The base64decode(Content)
Formula function decodes any base64encoded Content back to its original format.
base64decode with character encoding
New 5.4
base64decode(Content, 'source encoding')
For a list of supported character encodings, please review the following article List of encodings.
Quick example
Let's get you started with the following example: For other, and more advanced examples please scroll down on this page to the Examples section.
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
Text Data from Body part of logged event | base64decode expression | Unique values |
Features
- Decodes base64encoded strings back to its original format.
- Extracts single value only from Content.
- Can be applied to any valid Content that return base64encoded data; Like jsonpath, xpath functions, review Formula user guide for the complete list of functions.
Important
This plugin loads the entire message into RAM, so make sure to apply this function only on small messages.
How to use
To use the base64decode function, the Content parameter should contain a base64encoded string (otherwise it will fail and you will end up with a garbage result). But first and foremost we have to configure the Formula plugin:
- Select Formula as the expression type plugin.
- Write down the expression to use in the 'Expression' text area.
- Input proper Content as a parameter to the function.
Syntax
Use the base64decode function with any of the following parameters:
From Message Body:
base64decode(body)
From Message Context:
base64decode(context('MessageContextKey'))
Result from previous Formula operation
base64decode(SomeOtherNestedFormulaFunction(Content))
Examples
Below you will find different common examples of how to use the base64decode function.
Body as Content
The message body is base64 encoded text, by using the provided expression, the result is nodinite
.
Message Body
bm9kaW5pdGU=
Expression
base64decode(body)
Context as Content
Example: If "bm9kaW5pdGU=" is the value for the corresponding key "id", the result is "nodinite" when we apply base64decode function on the message context value as shown below.
e.g. base64decode(context('id'))
Message Context Value
bm9kaW5pdGU=
Expression
base64decode(context('id'))
Formula Function as Content
The message body is json structure, by using the provided expression, the result is Hello
, World
.
e.g. base64decode(jsonpath('$..name',body))
Message Body
[
{ "name": "YXdlc29tZQ==" },
{ "name": "ZnVuY3Rpb24=" }
]
Expression
base64decode(jsonpath('$..name',body))
You can use (any Formula plugin function) to extract the base64encoded data and base64decode to its original format.
Next Step
How to Add or manage Search Fields
How to Add or manage Log Views
Related
Expression Type Plugins are used in Search Fields
What are Search Fields?
What are Search Field Expressions?
What are Message Types?
What are Log Views?