-
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
How to filter the array of fields collected from Kafka Receiver in Body(Map) format? #28816
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
/label help-wanted |
Disregard based on @TylerHelmuth's comment below. |
Pinging code owners for processor/attributes: @boostchicken. See Adding Labels via Comments if you do not have permissions to add labels yourself. |
@ericashi the fields you want to remove from the log payload are in the body of the load, is that correct? If so, you can do this via the transformprocessor only. It would look like: transform:
error_mode: ignore
log_statements:
- context: log
statements:
- delete_key(body, "field_b") |
Hi @TylerHelmuth , Thanks for the solution provided. It is working now. Thank you for the help. Best Regards, |
Component(s)
processor/filter, receiver/kafka
What happened?
Description
I am consuming data from a Kafka Server using kafkareceiver. Currently, the consumed data is encoded in json logs format. The array of fields is in the "body" field in the logs displayed. Please refer to the "Log output" section for the logs displayed.
Currently, I wanted to filter the fields in the "body" field. For instance, there are 10 fields consumed for a topic and we need only 5 fields from the topic consumed.
I have tried using "resource_attributes" and also "bodies" configuration from "filterprocessor" but both are not working.
May I know how to filter the fields from the "body" fields, please?
Steps to Reproduce
Setup a config.yaml file with needed configurations and run the otelcol-contrib-collector binary.
Please refer to the "OpenTelemetry Collector configuration" section for the configurations.
Expected Result
I expected the un-needed fields to be filtered out.
Actual Result
No fields are being filtered out and will always store all the fields from the topic.
Collector version
v0.88.0
Environment information
Environment
OS: x86-64_linux_4.12_ImageSLES12SP5
OpenTelemetry Collector configuration
Log output
Additional context
May I know how can I filter out un-needed fields and only store the needed fields, please?
The text was updated successfully, but these errors were encountered: