From 8cb3256490f5f7c553575f241fdce5ff1c89956c Mon Sep 17 00:00:00 2001 From: Karsten Jeschkies Date: Fri, 22 Apr 2022 14:11:48 +0200 Subject: [PATCH 1/5] Document multi-tenant queries. --- docs/sources/operations/multi-tenancy.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/sources/operations/multi-tenancy.md b/docs/sources/operations/multi-tenancy.md index b72df12e155a3..9ceb8d78aaa29 100644 --- a/docs/sources/operations/multi-tenancy.md +++ b/docs/sources/operations/multi-tenancy.md @@ -17,3 +17,19 @@ To run in multi-tenant mode, Loki should be started with `auth_enabled: true`. Loki can be run in "single-tenant" mode where the `X-Scope-OrgID` header is not required. In single-tenant mode, the tenant ID defaults to `fake`. +## Multi-tenant Queries + +If run in multi-tenant mode, queries across different tenants can be enabled via +`multi_tenant_queries_enabled: true` option in the querier. Once enabled multiple +tenant IDs can be defined in the HTTP header `X-Scope-OrgID` by concatenating them +with `|`. For instance a query for tenant A and B can set `X-Scope-OrgID: A|B`. + +Only query endpoints support multi-tenant calls. 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. + +Instant and range queries support label filtering on the tenant IDs. For example +`{app="foo", __tenant_id__~="a.+"} | logfmt` will return results for all tenants +whose ID stat with `a`. Tenant ID filter in stages is not supported `{app="foo"} | __tenant_id__="1" | logfmt` will not work. + +In case the label `__tenant_id__` is already present in a log stream it is prepended with `original_`. From 0788599427d388f68c25edef9c2e8c8216612826 Mon Sep 17 00:00:00 2001 From: Karsten Jeschkies Date: Mon, 2 May 2022 10:08:41 +0200 Subject: [PATCH 2/5] Update docs/sources/operations/multi-tenancy.md Co-authored-by: Aleksey --- docs/sources/operations/multi-tenancy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/operations/multi-tenancy.md b/docs/sources/operations/multi-tenancy.md index 9ceb8d78aaa29..933576ec4a338 100644 --- a/docs/sources/operations/multi-tenancy.md +++ b/docs/sources/operations/multi-tenancy.md @@ -29,7 +29,7 @@ and `POST /loki/api/v1/push` will return an HTTP 400 error if more than one tena is defined in the HTTP header. Instant and range queries support label filtering on the tenant IDs. For example -`{app="foo", __tenant_id__~="a.+"} | logfmt` will return results for all tenants +`{app="foo", __tenant_id__=~"a.+"} | logfmt` will return results for all tenants whose ID stat with `a`. Tenant ID filter in stages is not supported `{app="foo"} | __tenant_id__="1" | logfmt` will not work. In case the label `__tenant_id__` is already present in a log stream it is prepended with `original_`. From 38d077e5f57b6783df4327bba673417431884e3d Mon Sep 17 00:00:00 2001 From: Karsten Jeschkies Date: Tue, 3 May 2022 17:15:29 +0200 Subject: [PATCH 3/5] Update docs/sources/operations/multi-tenancy.md Co-authored-by: JordanRushing --- docs/sources/operations/multi-tenancy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/operations/multi-tenancy.md b/docs/sources/operations/multi-tenancy.md index 933576ec4a338..74d0648013b2d 100644 --- a/docs/sources/operations/multi-tenancy.md +++ b/docs/sources/operations/multi-tenancy.md @@ -30,6 +30,6 @@ is defined in the HTTP header. Instant and range queries support label filtering on the tenant IDs. For example `{app="foo", __tenant_id__=~"a.+"} | logfmt` will return results for all tenants -whose ID stat with `a`. Tenant ID filter in stages is not supported `{app="foo"} | __tenant_id__="1" | logfmt` will not work. +whose ID stat with `a`. Tenant ID filtering in stages is not supported; `{app="foo"} | __tenant_id__="1" | logfmt` will not work. In case the label `__tenant_id__` is already present in a log stream it is prepended with `original_`. From 46b4107ffe57358ae4f136a866bc4bef391ee30b Mon Sep 17 00:00:00 2001 From: Karsten Jeschkies Date: Fri, 6 May 2022 20:21:19 +0200 Subject: [PATCH 4/5] Update docs/sources/operations/multi-tenancy.md Co-authored-by: Karen Miller <84039272+KMiller-Grafana@users.noreply.github.com> --- docs/sources/operations/multi-tenancy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/operations/multi-tenancy.md b/docs/sources/operations/multi-tenancy.md index 74d0648013b2d..34fbdb7190175 100644 --- a/docs/sources/operations/multi-tenancy.md +++ b/docs/sources/operations/multi-tenancy.md @@ -30,6 +30,6 @@ is defined in the HTTP header. Instant and range queries support label filtering on the tenant IDs. For example `{app="foo", __tenant_id__=~"a.+"} | logfmt` will return results for all tenants -whose ID stat with `a`. Tenant ID filtering in stages is not supported; `{app="foo"} | __tenant_id__="1" | logfmt` will not work. +whose ID start with `a`. Tenant ID filtering in stages is not supported; `{app="foo"} | __tenant_id__="1" | logfmt` will not work. In case the label `__tenant_id__` is already present in a log stream it is prepended with `original_`. From c19a8d29aa099b2cb861460e1cd93f63145e6bea Mon Sep 17 00:00:00 2001 From: Karsten Jeschkies Date: Fri, 6 May 2022 20:21:57 +0200 Subject: [PATCH 5/5] Update docs/sources/operations/multi-tenancy.md Co-authored-by: Karen Miller <84039272+KMiller-Grafana@users.noreply.github.com> --- docs/sources/operations/multi-tenancy.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sources/operations/multi-tenancy.md b/docs/sources/operations/multi-tenancy.md index 34fbdb7190175..11a2bb14d76df 100644 --- a/docs/sources/operations/multi-tenancy.md +++ b/docs/sources/operations/multi-tenancy.md @@ -19,8 +19,8 @@ required. In single-tenant mode, the tenant ID defaults to `fake`. ## Multi-tenant Queries -If run in multi-tenant mode, queries across different tenants can be enabled via -`multi_tenant_queries_enabled: true` option in the querier. Once enabled multiple +If run in multi-tenant mode, queries that gather results from multiple tenants can be enabled with +the `multi_tenant_queries_enabled: true` configuration option in the querier. Once enabled, multiple tenant IDs can be defined in the HTTP header `X-Scope-OrgID` by concatenating them with `|`. For instance a query for tenant A and B can set `X-Scope-OrgID: A|B`.