-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document multi-tenant queries. #5994
Changes from all commits
8cb3256
0788599
ad71ec1
66ef008
38d077e
46b4107
c19a8d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 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`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inserting. The piping worked for me. Let me investigate. Thanks for trying it out. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I've tried it with the Docker compose setup in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. analytics:
reporting_enabled: false
auth_enabled: true
common:
path_prefix: /var/loki
replication_factor: 1
storage:
s3:
access_key_id: access
bucketnames: bucketname
endpoint: endpoint
http_config:
idle_conn_timeout: 90s
insecure_skip_verify: false
response_header_timeout: 0s
region: region
secret_access_key: secret
compactor:
shared_store: aws
working_directory: /var/loki/compactor
frontend:
log_queries_longer_than: 20s
memberlist:
join_members:
- loki-memberlist
querier:
multi_tenant_queries_enabled: true
schema_config:
configs:
- from: "2021-09-07"
index:
period: 24h
prefix: loki_index_
object_store: aws
schema: v11
store: boltdb-shipper
storage_config:
aws:
access_key_id: access
bucketnames: bucketname
endpoint: endpoint
http_config:
idle_conn_timeout: 90s
insecure_skip_verify: false
response_header_timeout: 0s
region: region
secret_access_key: secret
boltdb_shipper:
active_index_directory: /var/loki/index
cache_location: /var/loki/index_cache
shared_store: s3
tracing:
enabled: true So i found that when use simple-scale helm chart. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like on my instance multi-tenant queries didnt work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are the screenshots showing? What are tags here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me explain. When i use But when i set So my first screenshots just trace from loki where read service get 0 Series when About promtail - already have tenants in loki and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for your patience. I'm not really sure where you see Anyhow, which version of Loki are you using? It must be a recent main build after at least commit c7cbeab. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes - i found problem. We didnt update master branch after release. |
||
|
||
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 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_`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder whether we should document how to setup a datasource in Grafana for multi-tenant queries. It is not trivial IMHO.