Formula - replace
Easily replace text in messages using the Nodinite replace
Formula plugin. This page shows how to substitute strings in message Content, Context, or the output of other formulas.
π― Designed for business users and integrators β no developer required; you can even use AI to craft expressions.
- β Replace text from any Payload or Context in any Log Event
- β Substitute all occurrences of a string with a new value
- β Transform and surface meaningful data in Nodinite Log Views, search filters, and self-service diagnostics
- β Combine with other Formula functions for powerful, layered expressions
What does the replace Formula do?
The replace('OldValue', 'NewValue', Content)
Formula function substitutes all occurrences of a specified string with a new value. Use it on message bodies, context values, or the results from other Formula functions to transform data in your views.
How it works: Input β replace β Result
Flow: The content is processed to replace all occurrences of the old value with the new value.
Example 1 β Replace a word in the message body
Input from body
nodinite
Formula Expression
replace('nodinite','most innovative product',body)
Result
most innovative product
Example: Replacing 'nodinite' with 'most innovative product' in the message body.
Example 2 β Replace a word in a context value
Suppose you have a message context value with the key id
containing nodinite
.
Input
nodinite
Formula Expression
replace('nodinite','most innovative company',context('id'))
Result
most innovative company
Example: Replacing 'nodinite' with 'most innovative company' in the context value.
Example 3 β Replace a word in a nested formula result
Suppose you have a JSON array with multiple names that need replacement.
Input
[ { "name": "Amazing Function" }, { "name": "Amazing Implementation" } ]
Formula Expression
replace('Amazing','Cool',jsonpath('$..name',body))
Result
Cool Function, Cool Implementation
Example: Replacing 'Amazing' with 'Cool' in all names returned by the jsonpath function.
Features
- Replace all occurrences of a string with another value in any Content
- Works with message body, context, or results from other Formula functions
- Combine with other Formula functions for powerful, layered expressions
- Use in Log Views for filtering, grouping, and self-service diagnostics
Important
The replace plugin loads the entire message into RAM. Only use this function on small messages to avoid performance issues.
How to use the replace Formula
- Select Formula as the expression type plugin.
- Enter your replace expression in the 'Expression' text area.
- Provide the old value, new value, and Content parameter (for example, the message body, a context value, or another formula result).
Syntax
- Replace in message body:
replace('OldValue', 'NewValue', body)
- Replace in message context:
replace('OldValue', 'NewValue', context('MessageContextKey'))
- Replace in another formula:
replace('OldValue', 'NewValue', SomeOtherNestedFormulaFunction(Content))
Next Step
How to Add or manage Search Fields
How to Add or manage Log Views
Related Topics
- 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?