-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[pkg/ottl] Add support PCRE2 regex syntax #32167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
@aofodo we use Go's built-in package for regex which I don't believe supports |
We are trying to remove the |
@amal-v can you share the PCRE2 regex you'd like to use for your use case? |
Ditto this. I have a use case where a span attribute is a JSON string and I need to obfuscate the JSON values with the exception of some that correspond to a specific JSON key. Doesn't seem possible without a negative lookbehind. for reference transform:
error_mode: ignore
trace_statements:
- context: span
statements:
- "replace_pattern(attributes[\"my-attribute\"], \"(?<!\\\"(key1|key2)\\\": )\\\"[^\\\"]+\\\"\", \"?\")" There's probably a way to do this by transforming across multiple transformation stages but a single regex solution is much preferable. |
Pinging code owners for pkg/ottl: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley. See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Negative lookahead isn't supported by Go's regexp package, so we'd need another regular expression package that does. |
I haven't had a chance to work with it, but this package go.arsenm.dev/pcre looks good. But it has limitations in target os and arch |
That will be a dealbreaker as OTTL needs to work in all the target architectures supported by https://github.com/open-telemetry/opentelemetry-collector-releases |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
This issue has been closed as inactive because it has been stale for 120 days with no activity. |
Component(s)
processor/transform
Is your feature request related to a problem? Please describe.
I need to mask PANs (card numbers) in logs. Card numbers can be in different versions. With different dividers, different lengths. It is important that other data is not accidentally masked. To do this, I use a complex regular expression, including lookahead and other features of the PCRE2 syntax. Without the syntax capabilities of PCRE2, it is impossible to fully mask card numbers
Describe the solution you'd like
Add support PCRE2 syntax in
processor/transform
forreplace_pattern
andreplace_all_patterns
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: