Skip to content

Commit 167c95c

Browse files
Docs: revise multi-tenancy prose (#6355)
* Docs: revise multi-tenancy prose * Update multi-tenancy docs using review comments
1 parent b65e11e commit 167c95c

File tree

2 files changed

+30
-15
lines changed

2 files changed

+30
-15
lines changed

docs/sources/configuration/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ The `querier` block configures the Loki Querier.
315315
# CLI flag: -querier.query-ingester-only
316316
[query_ingester_only: <boolean> | default = false]
317317
318-
# Allow queries for multiple tenants.
318+
# When true, allow queries to span multiple tenants.
319319
# CLI flag: -querier.multi-tenant-queries-enabled
320320
[multi_tenant_queries_enabled: <boolean> | default = false]
321321

docs/sources/operations/multi-tenancy.md

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,39 @@ Tenant IDs can be any alphanumeric string that fits within the Go HTTP header
1212
limit (1MB). Operators are recommended to use a reasonable limit for uniquely
1313
identifying tenants; 20 bytes is usually enough.
1414

15-
To run in multi-tenant mode, Loki should be started with `auth_enabled: true`.
15+
Loki defaults to running in multi-tenant mode.
16+
Multi-tenant mode is set in the configuration with `auth_enabled: true`.
1617

17-
Loki can be run in "single-tenant" mode where the `X-Scope-OrgID` header is not
18-
required. In single-tenant mode, the tenant ID defaults to `fake`.
18+
When configured with `auth_enabled: false`, Loki uses a single tenant.
19+
The `X-Scope-OrgID` header is not required in Loki API requests.
20+
The single tenant ID will be the string `fake`.
1921

2022
## Multi-tenant Queries
2123

22-
If run in multi-tenant mode, queries that gather results from multiple tenants can be enabled with
23-
the `multi_tenant_queries_enabled: true` configuration option in the querier. Once enabled, multiple
24-
tenant IDs can be defined in the HTTP header `X-Scope-OrgID` by concatenating them
25-
with `|`. For instance a query for tenant A and B can set `X-Scope-OrgID: A|B`.
24+
In multi-tenant mode, queries may gather results from multiple tenants.
25+
Set the querier configuration option `multi_tenant_queries_enabled: true` to enable queries across tenants.
26+
The query API request defines the tenants.
27+
Specify multiple tenants
28+
in the query request HTTP header `X-Scope-OrgID` by separating the tenant IDs with the pipe character (`|`).
29+
For example, a query for tenants `A` and `B` requires the header `X-Scope-OrgID: A|B`.
2630

27-
Only query endpoints support multi-tenant calls. Calls to `GET /loki/api/v1/tail`
28-
and `POST /loki/api/v1/push` will return an HTTP 400 error if more than one tenant
29-
is defined in the HTTP header.
31+
Only query endpoints support multi-tenant calls.
32+
Calls to `GET /loki/api/v1/tail` and `POST /loki/api/v1/push` will return an HTTP 400 error if more than one tenant is defined in the HTTP header.
3033

31-
Instant and range queries support label filtering on the tenant IDs. For example
32-
`{app="foo", __tenant_id__=~"a.+"} | logfmt` will return results for all tenants
33-
whose ID start with `a`. Tenant ID filtering in stages is not supported; `{app="foo"} | __tenant_id__="1" | logfmt` will not work.
34+
Instant and range queries support label filtering using tenant IDs.
35+
For example, the query
3436

35-
In case the label `__tenant_id__` is already present in a log stream it is prepended with `original_`.
37+
```
38+
{app="foo", __tenant_id__=~"a.+"} | logfmt
39+
```
40+
will return results for all tenants
41+
that have a tenant ID that begins with the character `a`.
42+
43+
If the label `__tenant_id__` is already present in a log stream, it is prepended with the string `original_`.
44+
45+
Tenant ID filtering in stages is not supported.
46+
An example of a query that will _not_ work:
47+
48+
```
49+
{app="foo"} | __tenant_id__="1" | logfmt
50+
```

0 commit comments

Comments
 (0)