-
Bug
-
Resolution: Unresolved
-
Normal
-
None
-
None
-
False
-
-
False
-
-
When the LokiStack is used and according to the CLF api docs:
type Loki struct { // TenantKey is a meta-data key field to use as the TenantID, // For example: 'TenantKey: kubernetes.namespace_name` will use the kubernetes // namespace as the tenant ID. // // +optional TenantKey string `json:"tenantKey,omitempty"`
We can set a static value to define the tenant using a label in the ClusterLogForwarder instance:
$ oc get clusterlogforwarder -n openshift-logging -o yaml spec: outputs: - name: loki-output type: "loki" url: http://lokioutput:3100 pipelines: - inputRefs: - application name: loki-pipeline labels: tenantKey: <tenantKey_value> [...]
Warning: due to performance problems it is highly advisable to use a tenantKey that does not generate many values and that does not fluctuate.
In the official documentation (https://docs.openshift.com/container-platform/4.14/logging/log_collection_forwarding/configuring-log-forwarding.html#cluster-logging-collector-log-forward-loki_configuring-log-forwarding) we can find:
loki: tenantKey: kubernetes.namespace_name labelKeys: - kubernetes.labels.foo
And the explanation says that: "Optional: Specify a metadata key field to generate values for the TenantID field in Loki. For example, setting tenantKey: kubernetes.namespace_name uses the names of the Kubernetes namespaces as values for tenant IDs in Loki. To see which other log record fields you can specify, see the "Log Record Fields" link in the following "Additional resources" section." But no documentation is defined for a static value.
It would be great to have in the same example, the label defined for defining a static value of the tenant.