to_string¶
The to_string()
function converts the provided argument to a string value. This function is typically used in template expressions (like setting a header) rather than in filter conditions.
Syntax¶
Parameters¶
value
: The value to convert to a string. This can be a boolean, integer, or IP address.
Return Value¶
Returns a string representation of the provided value.
Example (in an action)¶
This example shows how to_string()
can be used in a http.request.headers.set
action to create a custom header with the client's IP address.
# This is an example of how it would be used in an action, not a filter.
http.request.headers.set:
X-Client-IP-String: ${to_string(ip.src)}
Use Cases¶
- Converting numeric values to strings for concatenation in dynamic headers.
- Formatting IP addresses as strings for logging or custom header manipulation.
- Converting boolean values to strings ("true" or "false") for custom logic or reporting.
Note¶
This function is available only in template expressions (used in actions) and not in filter conditions.