@@ -12,24 +12,39 @@ Tenant IDs can be any alphanumeric string that fits within the Go HTTP header
12
12
limit (1MB). Operators are recommended to use a reasonable limit for uniquely
13
13
identifying tenants; 20 bytes is usually enough.
14
14
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 ` .
16
17
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 ` .
19
21
20
22
## Multi-tenant Queries
21
23
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 ` .
26
30
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.
30
33
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
34
36
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