Formula - base64encode
Perform a base64encode operation on the specified string.
The base64encode( )
Formula function encodes any text/string Content to base64encoding format.
base64encode with character encoding
New 5.4
base64encode(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 | base64encode expression | Unique values |
Features
- Encodes text/string to base64encoding format.
- Extracts single value only from Content.
- Can be applied to any valid Content that return text/string 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 base64encode function, the Content parameter should contain text/string data. 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 base64encode function with any of the following parameters:
From Message Body:
base64encode(body)
From Message Context:
base64encode(context('MessageContextKey'))
Result from previous Formula operation
base64encode(SomeOtherNestedFormulaFunction(Content))
Examples
Below you will find different common examples of how to use the base64encode function.
Body as Content
The message body is regular text "nodinite", by using the provided expression, the result is bm9kaW5pdGU=
.
Message Body
nodinite
Expression
base64encode(body)
Context as Content
"Simple" is the value for the corresponding key "id", by using the provided expression, the result is U2ltcGxl
.
Message Context Value
Simple
Expression
base64encode(context('id'))
Formula Function as Content
The message body is json structure, by using the provided expression, the result is SGVsbG8=
, V29ybGQ=
.
Message Body
[
{ "name": "Hello" },
{ "name": "World" }
]
Expression
base64encode(jsonpath('$..name',body))
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?