-
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
You want to dynamically determine the topic when exporting with Kafka Exporter. #31178
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
This looks like a reasonable request to me, if this gets triaged, would love to work on it. |
Hello @pyama86, can you share a proposal for what the configuration of this option would look like? |
@crobert-1 receivers:
filelog:
include: [ /var/log/containers/*.log]
operators:
- type: json_parser
processors:
# This processor is expected to extract k8s-related metadata from the logs,
# and add it as attributes to the logs.
k8sattributes:
exporters:
kafka/custom:
default_topic: default-topic
brokers:
- localhost:9092
topic_from_attribute: k8s.app
service:
pipelines:
logs:
receivers: [filelog]
processors: [k8sattributes]
exporters: [kafka/custom] It seems there's currently no way to access the attributes created by the processor, which would be very useful for various purposes. |
The idea sounds good to me, but I do wonder a bit at implementation details. Do you plan on only allowing resource attribute names to be the source of value for |
I think that users will likely want to input various values as needed, and the processor can generate or transform attributes accordingly, which seems to allow for reasonably flexible responses. On the other hand, I'm not very familiar with the implementation of the otel collector, so if there are any concerns or points that should be considered, presenting them would enable a deeper examination. |
That's fair. I think initially we can restrict it to resource attributes as the source. The resource attribute name can be the value for |
Is there anything else I can contribute to this matter? I'm willing to help with anything if there is something I can do. |
You're welcome to submit a PR if you're able! Otherwise it will depend on the priorities and availability of the component code owners, or other contributors. |
That's great! Whether it gets merged or not, I also believe that writing code is the best way to express what you want to do, so I'll give it a try. Thank you. |
…ibute. (#31809) I've implemented the feature based on the discussion in the referenced issue. I'm assuming it will suffice in most cases if the text attributes are available, so I haven't planned for arrays or maps. Fixes #31178 I've implemented unit tests. For the tests related to kafka_exporter, I followed the existing implementation, but I find it somewhat redundant. If it's okay, I'd like to switch to table-driven tests. --------- Co-authored-by: Curtis Robert <crobert@splunk.com> Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Component(s)
exporter/kafka
Is your feature request related to a problem? Please describe.
When adding log information to Kafka, you separate the topics by log file or type. However, currently, to do this, you need to write many exporter definitions.
Describe the solution you'd like
You want to dynamically determine the topic from metadata, such as the file name obtained from the Filelog Receiver.
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: