Replies: 9 comments
-
Update: It seems logging-framework uses the loki output from fluentd. I opened a ticket with fluend to also support this, then the logging-framework needs to pass through only? |
Beta Was this translation helpful? Give feedback.
-
I believe this is already supported by the fluentd loki plugin, see https://grafana.com/docs/loki/latest/clients/fluentd/#tenant.
Also, the associated logging-operator output field is already passed through to the fluentd configuration: https://github.com/banzaicloud/logging-operator/blob/42402497f2116f014f14ba867fdce13aba0bf171/pkg/sdk/logging/model/output/loki.go#L74 |
Beta Was this translation helpful? Give feedback.
-
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions! |
Beta Was this translation helpful? Give feedback.
-
thanks @aslafy-z for clarifying this! @fekete-robert is there a good place in the docs to add this? |
Beta Was this translation helpful? Give feedback.
-
I think we can do two things:
|
Beta Was this translation helpful? Give feedback.
-
I would opt for the separate page, but first someone should actually try this out whether it works correctly or not. I closed this prematurely, sorry. |
Beta Was this translation helpful? Give feedback.
-
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions! |
Beta Was this translation helpful? Give feedback.
-
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions! |
Beta Was this translation helpful? Give feedback.
-
Hi, sorry for commenting on a closed issue, but I dedicated some time testing this, so I figure I'll share my findings for others coming to the issue. Not being familiar with fluentd's configuration syntax, getting this working wasn't straight forward to me. Note Tested with Logging Operator v4.5.6, but I guess it should be the same for newer versions. Let's say you want to use the value of the You will need to add to your apiVersion: logging.banzaicloud.io/v1beta1
kind: ClusterOutput
metadata:
name: external-loki
namespace: logging
spec:
loki:
tenant: ${$.kubernetes.label.tenat}
# .. the rest of your config, like your Loki URL, etc.
buffer:
tags: tag,time,$.kubernetes.labels.tenant Warning Setting the
Also, you need to keep at least Once that you added the needed properties and applied to the cluster, give it some time to the operator to refresh fluentd's config. To verify that everything is working, you can then check the logs of fluentd and you should see some lines like these:
Note See that the apiVersion: logging.banzaicloud.io/v1beta1
kind: Logging
metadata:
name: <your stack's name>
spec:
fluentd:
logLevel: debug and
Note See that the tenant has correctly been set to the label's value at the end of the line. |
Beta Was this translation helpful? Give feedback.
-
Describe the solution you'd like
I want to define 1 default Loki ClusterOutput but not with a static tenant.
With this, tenants don't get to see the config (it's cluster level) and for 100 tenant's I don't need then to create 100 namespaced output's with the same loki endpoint and auth config with is unsecure and harder to maintain if something changes.
e.g.:
Additional context
We create multi tenant k8s clusters and use capsule to create Tenant's in the cluster.
It's not relevant to know how Capsule works internally, only that namespaces and pods have a certain label with their tenant id.
For logging, I need to extract this label to be forwarded as the tenant header (X-Scope-OrgId) to Loki.
I see in the code that something like this is available for kafka (headers_from_record in the crds):
More important: Fluentd also supports this:
https://docs.fluentd.org/output/http#headers_from_placeholders
For non-loki users it might be interesting to also add this feature (with a more generic name: headers_from_record) to the http output
Beta Was this translation helpful? Give feedback.
All reactions