You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Log bodies can be a string or a map. The func_replace_all_patterns works when body is a map, but does not work when body is a string.
Steps to Reproduce
Configure the collector to read a log file without parsing. This will result in a string body.
Use the Transform processor + replace_all_patterns to replace a sub string. In my example, I have an escaped json string that I want to remove the \ from. {\"key\":\"value\"} --> {"key":"value"}.
Because body can be a string, I would expect ottl functions to support them.
Actual Result
It works if my log message is at body.message but does not work if it is at body (string).
Alternatives Considered
I wrote an ottl function that wraps strings.ReplaceAll(). It supports the operation I am performing. I suspect this function would not be accepted as it overlaps with replace_all_patterns.
Collector version
v0.111.0
Environment information
Environment
OS: Debian 12
Compiler: Go 1.22.6
OpenTelemetry Collector configuration
No response
Log output
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
Component(s)
No response
What happened?
Description
Log bodies can be a string or a map. The
func_replace_all_patterns
works when body is a map, but does not work when body is a string.Steps to Reproduce
Configure the collector to read a log file without parsing. This will result in a string body.
Use the Transform processor + replace_all_patterns to replace a sub string. In my example, I have an escaped json string that I want to remove the
\
from.{\"key\":\"value\"}
-->{"key":"value"}
.Expected Result
Because body can be a string, I would expect ottl functions to support them.
Actual Result
It works if my log message is at
body.message
but does not work if it is atbody
(string).Alternatives Considered
I wrote an ottl function that wraps
strings.ReplaceAll()
. It supports the operation I am performing. I suspect this function would not be accepted as it overlaps withreplace_all_patterns
.Collector version
v0.111.0
Environment information
Environment
OS: Debian 12
Compiler: Go 1.22.6
OpenTelemetry Collector configuration
No response
Log output
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: