Skip to content

Commit

Permalink
Restore tenant configuration for Loki forwarder.
Browse files Browse the repository at this point in the history
This configuration will not be required for our default Loki instance,
but may be required for custom Loki instances.
  • Loading branch information
alanconway committed Jul 21, 2021
1 parent a5f4ca8 commit a5141ff
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions enhancements/cluster-logging/forward-to-loki.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.<key>`: Use the string value of kubernetes label with key `<key>`.
- `openshift.labels.<key>`: use the value of a label attached by the forwarder.

The full set of meta-data keys is listed in [data model][].

Expand All @@ -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
Expand Down Expand Up @@ -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

0 comments on commit a5141ff

Please sign in to comment.