-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
file_output automatically escape HTML entities in log records. #36050
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Thanks for reporting @dzhou3. This operator is really only for debugging purposes but I agree this bug make debugging imprecise, so we should address it. |
Ah, we were planning to use this operator (along with the router operator) to sort journald logs into different files based on log message patterns. Are you suggesting we should avoid doing this? |
Interesting use case. Realistically, I don't expect the operator to go away or change meaningfully, but this is the first time I've ever heard of a case where it would be strictly depended upon. I assume you've ruled out the file exporter? I wonder if an enhancement to that component would be able to solve your case more reliably. |
Yes, I've tried the combination |
Hi, I would like to look at this issue if possible |
According to the documentation, the interface is the same as for |
Component(s)
pkg/stanza
What happened?
Description
file_output operator automatically escapes special characters in log records when Go template is used to customize output format.
Steps to Reproduce
ingest some logs that contain special characters (e.g. single quote, greater sign and etc...) from journaldreceiver, and pipeline to a file_output operator with custom format (Go template).
Expected Result
The output file should show the same log content as the upstream log source.
Actual Result
The output file contains escaped characters.
I believe the root cause is file_output operator is using html/template instead of text/template.
Collector version
v0.108.0
Environment information
Environment
OS: Ubuntu 22.04
OpenTelemetry Collector configuration
Log output
The text was updated successfully, but these errors were encountered: