diff --git a/enhancements/cluster-logging/forward-to-loki.md b/enhancements/cluster-logging/forward-to-loki.md index 3aef722311b..64b5dcd0482 100644 --- a/enhancements/cluster-logging/forward-to-loki.md +++ b/enhancements/cluster-logging/forward-to-loki.md @@ -148,6 +148,12 @@ The following optional output fields are Loki-specific: Example: `kubernetes.labels.foo` => `kubernetes_labels_foo`.\ **Note**: `kubernetes.host` is *always* be included, even if not requested. It is required to ensure ordered label streams. +- `tenantKey`: (string, default=`"kubernetes.namespaceName"`) \ + Use the value of this meta-data key as the Loki tenant ID.\ + At least these keys are supported: + - `kubernetes.namespaceName`: Use the namespace name as the tenant ID. + - `kubernetes.labels.`: Use the string value of kubernetes label with key ``. + - `openshift.labels.`: use the value of a label attached by the forwarder. The full set of meta-data keys is listed in [data model][]. @@ -160,11 +166,24 @@ Notes on plug-in configuration: - Security: configured by the `output.secret` as usual. - K8s labels as Loki labels: supported by the plug-in. - Always include `kubernetes.host` to avoid avoid out-of-order streams. +- Tenant set from `output.tenantKey` - Output format is `json`, serializes the fluentd record like other outputs. - Static labels set as `extra_labels` to avoid extracting from each record. ### User Stories +#### Treat each namespace as a separate Loki tenant + +I want logs from each namespace to be directed to separate Loki tenants. + +``` yaml +- name: myLokiOutput + type: loki + url: ... + secret: ... + tenantKey: kubernetes.namespace_name +``` + #### Query all logs from a namespace ``` logql @@ -243,16 +262,11 @@ For example a CI test cluster that constantly creates and destroys randomly-name ### Upgrade / Downgrade Strategy -Need to provide migration assistance for users coming from Elasticsearch. -Out of scope for this proposal. - -### Version Skew Strategy +None. ## Implementation History -## Drawbacks - -## Alternatives +None. [label names]: https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels [data model]: https://github.com/openshift/origin-aggregated-logging/blob/master/docs/com.redhat.viaq-openshift-project.asciidoc