Formula - substring
Easily extract parts of strings using the Nodinite substring Formula plugin. This page shows how to slice strings from 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.
- β Extract string parts from any Payload or Context in any Log Event
- β Specify start position and length to extract exactly what you need
- β 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 substring Formula do?
The substring(StartIndex, Length, Content) Formula function extracts a specific part of a string, starting at a given position and continuing for a specified length. Use it on message bodies, context values, or the results from other Formula functions to extract data in your views.
How it works: Input β substring β Result
Flow: The content is processed to extract a substring from the specified start position for the given length.
Syntax
Extract from message body: (See Example 1)
substring(StartIndex, Length, body)
Extract from message context: (See Example 2)
substring(StartIndex, Length, context('MessageContextKey'))
Extract from nested formula: (See Example 3)
substring(StartIndex, Length, jsonpath('$.path', body))
Common patterns:
substring(0, 4, body) # Extract first 4 characters
substring(0, 10, context('OrderId')) # Extract first 10 characters from context
substring(5, 3, body) # Skip 5 characters, extract next 3
Note: Indexes are zero-based (first character is at position 0).
Examples
Example 1: Extract from message body
Input
Message body contains:
nodinite
Formula Expression
substring(0, 4, body)
Result
nodi

Example: Extracting the first 4 characters from the message body using substring formula.
Example 2: Extract from context value
Suppose you have a message context value with the key id containing Amazing Function.
Input
Context value:
Amazing Function
Formula Expression
substring(0, 7, context('id'))
Result
Amazing

Example: Extracting the first 7 characters from a context value using substring formula.
Example 3: Extract from nested formula result
Suppose you have a JSON array with names that you want to extract portions from.
Input
Message body contains:
[ { "name": "column" }, { "name": "olive" } ]
Formula Expression
substring(0, 2, jsonpath('$..name', body))
Result
Co, ol

Example: Extracting substrings from nested JSON using jsonpath and substring formulas.
Features
- Extract substring from any Content by specifying start position and length
- 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 substring plugin loads the entire message into RAM. Only use this function on small messages to avoid performance issues.
How to use the substring Formula
- Select Formula as the expression type plugin.
- Enter your substring expression in the 'Expression' text area.
- See Syntax section above for common patterns and usage examples.
Note: Indexes are zero-based (first character is at position 0).
Next Step
How to Add or manage Search Fields
How to Add or manage Log Views
Related Topics
- What is Formula?
- concat - Join multiple strings together
- replace - Replace text with simple matching
- replaceregex - Replace text with regular expressions
- jsonpath - Extract data from JSON
- xpath - Extract data from XML
- Expression Type Plugins are used in Search Fields
- What are Search Field Expressions?
- What are Log Views?