base64decode Formula function

The base64decode(Content) Formula function decodes any base64encoded Content back to its original format.

Quick example

Let's get you started with the following simple demonstration example valid for this Formula plugin. For other and more advanced examples please scroll down on this page to the Examples section.

Input Expression Result

Tm9kaW5pdGU=


base64decode(body)


Nodinite
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 on any valid Content that return base64encoded data; Like jsonpath, xpath functions, review Formula user guide for complete list of functions.

This plugin loads the entire message into RAM, so make sure to apply this function on smaller messages only

How to use

In order to use the base64decode function the Content parameter should contain a base64encoded string (otherwise it will fail and you will end up with garbage result). But first and foremost we have to configure the Formula plugin:

  • Select Formula as expression type plugin.
  • Write down the expression to use in the 'Expression' text area.
  • Input a proper Content as 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 for how to use the base64decode function.

Body as Content

The message body is base64 encoded text, by using the provided expression the result will be nodinite.

base64decode

Message Body


  bm9kaW5pdGU=

Expression


base64decode(body)


Context as Content

Example: If "bm9kaW5pdGU=" is the value for the corresponding key "id", the result will be "nodinite" when we apply base64decode function on the message context value as shown below.

e.g. base64decode(context('id'))

base64decodeMessageContext

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 will be Hello, World.

e.g. base64decode(jsonpath('$..name',body))

base64decodeJson

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

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?