Skip to content
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

Provide a "SED-like" mechanism to "find and replace" characters in a log record. #7396

Closed
matthewmodestino opened this issue Jan 26, 2022 · 13 comments
Labels
enhancement New feature or request processor/transform Transform processor

Comments

@matthewmodestino
Copy link

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

As an OTel native logging user, I need a way to "find and replace" characters that may exist in the original log record that I don't want/need in the logging backend. This can be useful to anonymize info, but also to make log records more usable in logging backends.

My current example is removing ANSI colour codes from my log files...

[2022-01-04 01:51:50] [36mINFO[39m "GET /ads.txt" [36m301[39m 10ms

Describe the solution you'd like
A clear and concise description of what you want to happen.

I want to define a SED command processor to find and replace the ANSI colour codes, or any other characters in the log record, as I see fit. Something like:

SEDCMD-removecolorcodes = s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

I looked through existing OTel processors but I only see REGEX based ones, and none that make it easy to achieve "find and replace" in existing log pipelines

Additional context
Add any other context or screenshots about the feature request here.

Sometimes kubernetes or application logs will use colour codes to make pretty printing when viewed in a terminal, or may include strings that need to be anonymized or replaced to make the log more usable by the user in the logging backend.

image

@atoulme atoulme mentioned this issue Jan 26, 2022
10 tasks
@jpkrohling
Copy link
Member

@bogdandrutu, @anuraaga, is this something the transform processor should take care of?

@matthewmodestino
Copy link
Author

Bump.

Any progress on transform processor?

Would be really handy to have the if style expressions that the log collection operators support.

@anuraaga
Copy link
Contributor

Hi @jpkrohling sorry for not responding to the question - yes replacement, possibly with SED syntax or something equivalent, is a function we'd want in the transform processor.

@matthewmodestino Sorry for the delay, just sent #8972 with a big step in being able to add logs support

@matthewmodestino
Copy link
Author

Sweet!

In the logs signal, we would likely need to apply this conditionally,ie. based on resource or attribute values. Looking forward to seeing how this turns out!

@codeboten codeboten added the needs triage New item requiring triage label Sep 16, 2022
@github-actions
Copy link
Contributor

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 @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

@github-actions github-actions bot added the Stale label Nov 16, 2022
@matthewmodestino
Copy link
Author

Bump. Still need this.

@jpkrohling
Copy link
Member

jpkrohling commented Nov 23, 2022

@kovrus, @TylerHelmuth, is this doable today with OTTL?

@jpkrohling jpkrohling added enhancement New feature or request processor/transform Transform processor and removed Stale needs triage New item requiring triage labels Nov 23, 2022
@github-actions
Copy link
Contributor

Pinging code owners: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley. See Adding Labels via Comments if you do not have permissions to add labels yourself.

@TylerHelmuth
Copy link
Member

@matthewmodestino checkout the transform processor and the function replace_pattern. Does that fit your needs?

@kovrus
Copy link
Member

kovrus commented Nov 23, 2022

👍 replace_pattern(body, regex, "") probably can address that.

@matthewmodestino
Copy link
Author

Will give it a shot! Thanks!

@TylerHelmuth
Copy link
Member

@matthewmodestino I'm going to close this based on the transform processor's capabilities. Please ping me if you think it should stay open.

@matthewmodestino
Copy link
Author

Sounds good, been meaning to circle back and test. Will hit you up if need be. Thanks!

ZahidMirza95 pushed a commit to ZahidMirza95/opentelemetry-collector-contrib that referenced this issue Jun 21, 2023
…pace on device (open-telemetry#7396)

* add full storage test for persistent storage

* improve no disk space handling in persistent storage

* review fixes

* review fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request processor/transform Transform processor
Projects
None yet
Development

No branches or pull requests

6 participants