-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Loki exporter: handle multi-tenant use cases #3121
Comments
This dynamic tenant ID could be based on log attributes ? |
Thank you so much for creating this issue and referencing our Slack conversation, @jean! Much appreciated. Could we also split this issue into two? One for mutli-tenant based on attribute and the other for adding Span support to the exporter? The Span support is more complex and will likely have some long discussions on the best path for implementation. |
Thank you, @jean! |
@jean This was posted a year ago, I am curious to know what you ended up doing for your use case? @gillg The So, how about a more generic solution that could be implemented in other exporters as well as Loki? For example: processors:
k8sattributes:
exporters:
loki:
headers:
- action: insert
key: X-Scope-OrgID
from_attribute: k8s.namespace.name
otlp/tempo:
headers:
- action: insert
key: X-Scope-OrgID
from_attribute: k8s.namespace.name |
@politician we're sending directly to Loki, not using OTel. |
I like it. To see with other maintainers if it's not too bad to do this kind of transformations outside processors. But saying it, it doesn't alter data, we just reuse an internal lib to insert/upset/delete data inside an http header, so that seems correct |
I think we have almost all of the pieces to get this done, but we need a small change to the loki exporter. I'll add this to my queue, unless someone else is interested. |
@jpkrohling looking at this one, please assign it to me |
As we briefly discussed via Slack, we might not even need any code changes. If you can get it working with the current options already, that would be great. Otherwise, we can make this exporter aware of the recent changes to the client package: if the user has specified that the source of the tenant information is the original request, we could try to get it from the client from the context. |
@jpkrohling can you please show an example yaml config of how to use it if there are no code changes? An example of using a k8s workspace as tenant like I've shown in my snippet would be great since it's kind of a standard use case. |
Sorry, my comment was meant to @otaviocarvalho. He'd be the one trying to get a working config, and if he can't, we'll do some code changes. |
Does this solution of exporting headers is available also in Kafka exporter? i.e if I want to set a specific attribute field in the Kafka message header. |
@itaykat, if you didn't have an answer yet, it might be better to open a new issue with your question. I'll then tag the Kafka exporter code owners. @otaviocarvalho, do you have an status on this one? |
* `exporter/loki`: handle multi-tenant use-cases Fixes #3121 Signed-off-by: Juraci Paixão Kröhling <[email protected]> * Add changelog entry Signed-off-by: Juraci Paixão Kröhling <[email protected]> * linter suggestions Signed-off-by: Juraci Paixão Kröhling <[email protected]> * Fail when both TenantID and Tenant are specified Signed-off-by: Juraci Paixão Kröhling <[email protected]>
Is your feature request related to a problem? Please describe.
The lokiexporter has a
tenant_id
parameter that can set theX-Scope-OrgID
HTTP header, but this sets a single static tenant.We will have logs from 1000s of orgs coming in, and we were assuming that client devices would be setting
X-Scope-OrgID
HTTP header, and that the exporter would be passing this through to Loki, resulting in 1000s of separate per-org log streams in S3.Currently this would require an exporter instance per tenant, which doesn't work.
Describe the solution you'd like
Enable passing OrgID either as the
X-Scope-OrgID
HTTP header or as a tenant "Attribute" on the spans/logs.We want to send logs in the form of spans. I've created a separate issue for that: #3166
Describe alternatives you've considered
We don't at this time have an alternative for routing logs to S3 for long-term storage via the Collector.
Additional context
Related issues:
The text was updated successfully, but these errors were encountered: