-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 Plugin] Allow setting X-Scope-OrgID header dynamically #2935
Comments
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
This issue was closed because it has been stalled for 5 days with no activity. |
assigned to @nokute78 |
@marpio @edsiper How about add new option like ExampleIncoming data is
Option is
Then I'm not familiar with kubernetes, is it meaningful for this issue ? |
@nokute78 It would be great to have a tenant_id_key and be able to set the namespace name/value from filter_kubernetes dynamically 👍 |
@nokute78 yes, that would be perfect. I'm already using the kubernetes filter and yes, it's possible to extract the name of a namespace. Thanks! |
Signed-off-by: Takahiro Yamashita <nokute78@gmail.com>
Up voting and @marpio @dbluxo Thank you! I sent a patch #3260. It is a simple implementation, so it may not handle such events. Disclaimer: e.g.
|
@nokute78 Thanks for your quick implementation!
Isn't that a bit dangerous if a user wants to map a multi-tenancy via this option? It certainly happens very often that a request to Loki contains logs from different Kubernetes namespaces, because Pods from different namespaces run on one node. |
@dbluxo Thank you for the comment especially kubernetes. Hmm, current loki plugin creates 1 http request from N events, this design causes that Disclaimer. Hmm... |
@nokute78 I have the same concern as dbluxo. Basically fluent-bit, in my environment, is running as a DaemonSet (one instance on each node). Since every node can host multiple pods from many namespaces, it potentially also reads logs from multiple tenants (in my case tenant maps to a namespace). With this implementation, tenant A would be able to see logs from tenant B which would defeat the purpose of this feature. Thanks again and let me know what you think. |
@marpio Thank you for comment. What I think is here. Is it meaningful?
e.g.
The Loki plugin creates 2 units. Unit A
and Unit B
Finally, the plugin sends 2 http requests. |
@nokute78 yes, this is exactly how it should work |
@nokute78 Your suggestion is great! I think with the |
I tested this example log. It contains multiple namespace_names.
rewrite_tag plugin serializes and rewrites tags like
and
and
Then #3260 will set Configuration example
Pipeline
|
@nokute78 Do I understand this correctly, by serializing (using What would the configuration have to look like if you wanted to use the kubernetes filter to set the |
Yes. In this case, 3 http requests are sent. (You can check that behavior using current release version except The point is
(something input) -> filter_kubernetes (appends |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
not stale |
Signed-off-by: Takahiro Yamashita <nokute78@gmail.com>
Signed-off-by: Takahiro Yamashita <nokute78@gmail.com>
Signed-off-by: Takahiro Yamashita <nokute78@gmail.com>
Is your feature request related to a problem? Please describe.
Similar to the to the situation described in grafana/loki#259 we control both the Loki backend and the fluent-bit installation and are running multiple tenants on Kubernetes (a tenant is a namespace), and would like to set the tenant (controled by X-Scope-OrgID) based on said namespace.
Describe the solution you'd like
I would like to be able to set the X-Scope-OrgID dynamically based on a field (in my case the namespace) provided by the kubernetes filter.
Describe alternatives you've considered
I could put a proxy in front of the Loki API that would inspect the labels and split the logs accordingly.
Additional context
As already mentioned in grafana/loki#259 the scenario where both sides are controlled is pretty common and it would be great if the native Loki plugin would support that just as Promtail and, indirectly (via a reserved
__tenant_id__
label)the fluent-bit plugin from Grafana https://grafana.com/docs/loki/latest/clients/fluentbit/ does.The text was updated successfully, but these errors were encountered: